Convection occurs through heat transfer due to a difference in density in the fluids.
Consider a pot of water being heated. The water in the pot gets heated rises ,it provides energy for the particles in the water to move and thus the water expands which results in the density of the water becoming less. These particles rise up till the top of the pot owing to the property of very less density of the particles.
Then after some time, it cools down which results in increase of the density of the particles. The heavier denser particles sink to the bottom and is once again heated and rises and this process continues unless all the water particles in the pot are heated and warmed.This transfer of energy by the movement of particles cause convection.
During the day the heat surface above the earth exposed to the sun's rays is heated. This rise in temperature,decreases the density of the air and the warm air rises.
This air cools down and becomes denser. This dense cool air sink back and forces the warm air to rise again.
This transfer of movement of particles causes convection. This cycle is the cause of winds and thus energy is transferred through the atmosphere.