This motion is a form of kinetic energy. Things that moves and have mass have kinetic energy. Air molecules move and have mass, so they have kinetic energy. Air temperature is essentially a measure of the average kinetic energy of the air molecules.
The faster the molecules move, the higher their kinetic energy and therefore the higher their temperature. The slower they move, the lower their kinetic energy and temperature. If they stop moving altogether, the temperature drops to Absolute Zero which is -273 degrees Centigrade. It's called Absolute Zero because that is the coldest you can get. You can't move slower than not moving at all.
Now there is one more concept to explain to understand why it is colder at higher elevations. It covers the conversion between one type of energy and another. In this case, it is the conversion from kinetic energy to potential energy.
We already discussed that kinetic energy is related to speed. The faster something moves, the more kinetic energy it will have. Now consider what happens when you throw a ball into the air. The higher it goes, the slower it goes. Eventually, it slows to the point where it stops and starts heading back to the earth. When the ball slows down, it loses kinetic energy, but it is gaining potential energy. The form of potential energy that the ball gains is in the form of height. It took energy to raise the ball, and that energy came from the kinetic energy.
So now to answer the question.
When the warm air rises, the speed of those air molecules slows down just like a ball that is thrown into the air slows down. The molecules convert their kinetic energy into potential energy when they rise into the air just like the ball did. And since temperature is a measure of kinetic energy, the lower kinetic energy means a lower temperature.
Answered by: Jim Jaskol, B.S., Engineer - BSEE from UCLA, Los Angeles
'All of us, are truly and literally a little bit of stardust.'