The planned cruising altitude of a flight is planned well before takeoff. Dispatchers in AA's SOC take into account enroute weather, winds aloft, aircraft capabilities and pax/cargo loads, and typical routes between the two cities in coming up with the planned altitude. Before the flight, the captain pulls the flight plan, and if he agrees with everything, he signs it and that's that. Of course, the planned altitude could change enroute due to weather, turbulence or whatever.
The higher you fly, the less fuel you burn, so they usually "aim high" for altitude...at least as much as practical for the route. My favorite raw performance jet is the 757. I used to live in TUL, and AA flies one 757 a day between DFW and TUL. We took off from DFW one night and climbed straight to 39,000 feet for a 36 minute flight. As soon as we leveled off, we started down. For that airplane, that was probably the most fuel efficient way to do things as your fuel burns go way down at altitude, and then down even more when you yank the throttles back for descent.