So air, like most other substances, expands when heated and contracts when cooled. Because there is more space between the molecules, the air is less dense than the surrounding matter and the hot air floats upward.
The upward motion of air is driven by the fundamental principle that warm air is less dense than cold air, and it rises due to buoyancy.