The heat of the sun penetrates the atmosphere and warms the Earth's surface. The warmed rEarth Radiates and this heat back into the atmosphere.The gases the surround the atmosphere such as carbon dioxide , methane , nitrous oxide and water vapour absorb some of the radiated heat and send it back to the Earth . This trapping of heat from the Sun by excess carbon dioxide and other gases present in the atmosphere is known as the greenhouse effect. The gases involved in the phenomenon are called greenhouse gases.
Hope it helps ~(•‿•)