This simplified diagram of the greenhouse effect shows how the atmosphere acts like a greenhouse trapping solar radiation and heating the Earth system.
This image is courtesy of NASA