While the sun is very hot it doesn't emit this energy to the Earth as heat but rather as solar radiation. The majority of this solar radiation passes through the upper and lower atmosphere before being absorbed by land and water when it hits the Earth's surface. It is then radiated as heat.
This radiated heat warms the bottom 15km of the atmosphere, which is where we live and where the world's weather occurs. This part of the atmosphere is called the troposphere.
The troposphere is heated from the bottom up.
"Air however is not a great conductor of heat, so the further you move away from the Earth's surface the cooler the air will get,