There are two primary reasons for this.
2.Engines (which are essentially hundreds of little wings spinning really fast!)
Lift is generated by the difference in air pressure between the top and the bottom of the wing. This is influenced by the speed of the air flowing over the wing and the density of the air.
As air gets less dense at higher altitudes, to generate sufficient lift you have to make the air over the top of the wing go faster by flying faster. But if you go too fast, some of the air going over the top of the wing goes faster than the speed of sound and breaks away from the wing, causing a loss of lift. With an increase in speed near Mach 1, drag increases substantially.
All while this is happening, all of those little wings inside the engine are undergoing the same processes associated with less dense air, so the engine can’t produce as much thrust.
But there is a savings because of less drag at high altitude, and engines burn substantially less fuel at altitude so generally, we want to fly as high as we can without coming too close to these limitations.
Finally, engines are used to generate pressurization for the cabin and, to keep a safe cabin altitude for the passengers, they need to work harder at higher altitude, robbing even more power that could be used for thrust.
Having an engine with more thrust is possible, but then you have to always carry around a bigger, heavier engine even when you don’t need it, burning more fuel all the time, just to save a bit, some of the time. And you still have that problem with breaking the speed of sound.
A combination of high performance wings and engines allow some aircraft to fly higher and faster, most notably jet fighters and business jets and aircraft like the 747 with its huge wings. And passenger aircraft with light loads can fly higher than when they are near their maximum weight.
Another consideration for picking an altitude is that the “jet stream” is often in the low-to-mid-thirty thousands so when flying on routes where the jet stream gives a fuel advantage, airlines simply pick the major fuel saving advantage of the jetstream over the minor advantage of altitude. The irony of this is that, when flying opposite to the prevailing winds jet stream, we need to carry more fuel between the same two points and often can’t take advantage of the higher altitudes so we avoid it by flight planning laterally away from it. The fact that the jet stream is lower also reduces the pressure to build higher flying aircraft…. airlines want to fly at these lower altitudes half the time to take advantage of “the jet”.
But the “sweet spot” of low drag and flyability for most commercial aircraft is in the range of 33,000 and 40,000 ft.