When the sun's light beams enter our atmosphere some of the heat is reflected from the ozone layer, some of the light beams travel through that and reflect off the clouds but for the remaining it comes through bounces off the earth's crust and when it is heading back out of the atmosphere the greenhouse gases reflect it back in heading towards the earth. 
The glass on the greenhouse stops temperature from leaving or entering like the gases do to the earth. 

The atmospheric gases are called 'greenhouse gases' based on the idea that the gases 'trap' heat like the walls of a greenhouse do
8 3 8