It’s been a while since my ATPL performance course (and it hurt my brain at the time), but in very simple layman’s terms:
Jet engines are most efficient at high power settings (say around 90-95% of maximum fan speed, or N1). For the best specific fuel consumption (i.e. miles per gallon) you would want to operate at an altitude where the aircraft maintains unaccelerated straight and level flight with the engines running at 90-95% N1.
Setting this sort of power at low altitudes (and therefore higher air density), the engines would produce so much thrust that the aircraft would accelerate way past its maximum operating speed (Vmo). As density reduces with altitude, so does thrust, so by climbing to high altitude (typically 33 – 39,000 feet depending on aircraft type, performance and weight) you reach a point where the thrust delivered at your most efficient engine speed is insufficient to climb or accelerate any further, but will just maintain unaccelerated straight and level flight at your optimum cruise speed or mach no. Of course, in the real world, weather, ATC restrictions and a whole host of other factors interfere to make the selection of cruise speed and altitude a bit of a compromise.
Hope that makes sense, but if not don’t worry - this being Pprune, someone much more knowledgeable than me will be along in a minute . . .