The earth as a whole is a closed system (at a simplistic level), when it heats up, there has to be a location where things cool down to maintain balance, otherwise it just keeps getting hotter and hotter.
The sun heats the earth’s surface. As shown below.
This is the basic mechanism for creating circulation of air masses. These air masses are covered more in-depth in the atmosphere section.
Much of the radiation is absorbed by the earth’s surface (mountains, oceans, land masses), some of it by clouds, and a fair amount reflected by the clouds.
In a perfectly closed system, everything entering = everything leaving
The earth must compensate for the incoming energy.
So what happens is that the earth will take the energy that’s building up in the surface (primarily in the tropics), and dump it in the mid-latitudes. In doing so, it releases some of the energy and that’s where our storms come in.