Bodies at different temperatures emit radiation of different corresponding wavelengths and, at temperatures of over 5500 degrees Celsius, the Sun emits radiation in the form of visible light (taking 8 minutes to reach us from the star's surface) which explains why it illuminates our daytime sky.
Humans are no different; we too emit radiation, which is how we keep warm.
This type of radiation, infrared radiation, also constitutes the majority of the radiation emitted by the Earth's surface, which averages 14 degrees Celsius thanks to internal geothermal processes and incident radiation from the Sun. The emitted space-bound radiation does not all pass through our atmosphere. Molecules which contain polar bonds (bonds between atoms which differ in their ability to attract electrons) absorb and reradiate this energy, vibrating as they do so. One such molecule abundant in our atmosphere is carbon dioxide.
Reradiated energy
While some of this absorbed radiation is reradiated out into space, a portion of it is is directed back towards the Earth's surface as shown above. Now we must introduce the concept of thermal equilibrium: two bodies in thermal equilibrium must have the same temperature, and a system of bodies always tends towards equilibrium.
This reabsorbed infrared radiation increases the temperature of the uppermost part of the Earth's surface and to maintain equilibrium, the Earth must increase its rate of heat radiation (through radioactive processes within the core). This means that the Earth radiates more energy in a given time period, and the cyclic effect intensifies.
You may have heard this effect referred to as the greenhouse effect, and, frankly, it gets a bad rap.
It is responsible for life as we know it. If molecules such as carbon dioxide were not present in our atmosphere, Earth's surface would be 33 degrees Celsius cooler - well below freezing - and you would not be reading this article.
The bad news
The negative consequences for which the greenhouse effect is famous come when atmospheric carbon dioxide levels become unsustainable. Analysis of fossils and air trapped in ancient Antarctic ice suggest that atmospheric levels of the gas experience cycles of peaks and troughs naturally, and many scientists suggest that the natural 'troughs' after peaks in these fluctuations represent recent 'ice ages' (periods of global arctic temperatures).
However, in the last 650,000 years, evidence from these findings suggests that carbon dioxide has constituted an average of fewer than 300 parts per million in our atmosphere. The current figure sits at around 400 parts per million, and has been steadily rising since man's industrial revolution; current projections suggest that atmospheric carbon dioxide concentration will reach 600 parts per million by 2050, which would have devastating consequences. Rising sea levels would put the livelihoods of millions of coastal people at risk, and soaring temperatures could cause widespread drought and famine inland.
Scientists consider it of paramount importance that this prediction is not made a reality, and already steps are being taken by governmental authorities worldwide to reduce global emissions and avert a potential crisis, including forays into renewable energy and restrictions on industry before it's too late.
References:
https://goo.gl/iPJJ3Q
https://giphy.com/search/polar
University Physics with Modern Physics, 13th Edition, Young & Freedman