Dear Student
The lower atmosphere called troposphere is heated from below by the suns radiation interacting with the earth's surface. The presence of water in troposphere and its phase changes from solid to liquid to gas also encourages energy transfer because the specific heat of the water is high it can store a lot of heat that is why it is warmer.
The upper atmosphere (stratosphere) is heated from above. Much of the heat comes from sun (ultra violet light) interacting with ozone molecules. Because of the warmer less dense air is on top, the stratosphere is very stable. It is also dry and doesn't absorb much of the sun's energy so it has less temperature than troposphere.
Regards