The Earth is continuously receiving energy from the sun. Energy also leaves the Earth at night (of course in the form of invisible infrared energy!). Otherwise, the Earth would be continuously warming up. This delicate balance between the energy coming in and leaving due to natural greenhouse effect is what keeps the planet warm enough for us to live on.
It is very obvious that if more energy comes in than the energy that leaves, the planet will become warm. Similarly, if the energy that leaves is more than the energy that comes in, the planet will become cool. The atmospheric temperature fluctuates over centuries due to certain natural causes. However, our "recent" (on a geological timescale) use of fuels that have been trapped underground are quickly changing the environment outside of these natural norms.
Go to the next screen to view an animation of the greenhouse effect.