The short wave radiation from the Sun can pass through the glass, this then warms up the things inside the greenhouse and they emit much longer wavelength heat radiation. It is this longer wavelength radiation from the cooler objects that cannot get through the glass and so the inside of the greenhouse warms up. The glass of the greenhouse also prevents convection currents carrying the warmed air out of the greenhouse. Opening the roof vents in a greenhouse will prevent it heating up too much.