Imagine a world where there were no change fees, and no cancellation fees. If you bought a ticket and then changed your mind, you could just cancel or change it. In this world, tickets would not be cheaper if you bought them in advance. After all, I could buy a ticket for a year from now then change it the day I was going to fly, and the airline would have to accommodate me. They wouldn't get a benefit from my making firm plans in advance, so they wouldn't motivate me with money to make my plans in advance. You probably wouldn't like this world, because all plane tickets would cost about what "I need to fly this week" plane tickets cost today, which is about 5x what you pay if you plan far enough in advance.
Now, imagine the same world with no change fees or cancellations, but with no refunds either. You buy a ticket, use it or not, we don't care, but it's paid for. A bit like putting a subway token in a turnstile but then not going through. You wouldn't like this world either: plans do change and people don't want to lose all the money they paid for a plane ticket. Travel insurance exists, but doesn't cover everything.
So, ok, the airline is going to charge you some money to change or cancel your plans. There are two ways to establish that charge. One is "what does it cost them" which is a few pennies in IT stuff and then possibly thousands in switching to a bigger plane for the route or whatever. That's too much of a lottery for passengers to take on. A sort of average charge of a few hundred might be fairer. But the other approach is "what will deter this behaviour?" If changes cost hundreds, you won't book until you're really very sure you going to do it. (Example: I book hotel rooms for events I might or might not attend, since they book up fast and can be cancelled no charge. I don't buy the plane tickets until I know for sure I'm going.)
Then on top of that you have to think about the system-gamers. You fly once or twice a year. But there are people who fly every week. And they want to get upgraded, they want maximum status miles, they want to be home half an hour earlier than they would normally be, and all kinds of things that aren't an option for you or don't matter for you. They invest time and energy into gaming systems. They book three flights from A to B on the same day, so they can decide on the day which one they want and that's cheaper than buying a last minute ticket on the day. They do "nested returns" and "hidden cities" and a ton of things you'd never do. The fees have to be robust against that kind of nonsense too.
So what this adds up to is that fees must exist, mostly to control your behaviour and make your plans firmer, so that they can plan their staff and equipment usage properly. Sometimes it seems like they would do better if they didn't charge you that fee -- but that's because you haven't thought about how to game that if you fly that route every single week.