The sun radiates and these rays enter our atmosphere. If there is a lot of carbon dioxide, the rays and radiation are prevented from leaving the the atmosphere, which means that the heat and energy stay inside and heat the planet more and more, which leads to global warming.