When air is heated, its molecules move at an increased velocity due to an increase in kinetic energy. The increase in energy allows the gas to expand as the temperature increases.
According to the kinetic molecular theory, the average kinetic energy of molecules in any substance is directly proportional to the temperature of the substance. This means that when heat is supplied to an object, the temperature increases and the kinetic energy of the molecules also increases. Kinetic energy is directly proportional to the velocity of the molecules, which implies that increased kinetic energy results in molecules moving at a higher velocity.
Air is a gas; therefore its molecules fill the entire space of its container. When the air is heated, the temperature of the gas increases. The kinetic energy and the velocity of molecules increase with the temperature. As the molecules start moving with increased energy, they collide more quickly and more frequently with the walls of the container. If the container walls are rigid, then the pressure of the gas increases with no change in volume. But if the walls of the container are flexible (like a balloon), the increased energy of the collisions between the wall and the molecules causes the container to expand.