A greenhouse is made of panes of transparent glass or polyethelene attached to a metal structure to hold it up. When sunlight shines into the greenhouse, some of it bounces off of plants, racks and other objects and is reflected back out through the windows. A lot of the light, however, is absorbed by the plants and other objects inside of the greenhouse. The light is turned into heat when it is absorbed.
Heating it Up
As the floor, plants, plant racks and other objects in the greenhouse absorb heat and rise in temperature, they begin to warm the air around them and that warm air begins to rise. This is similar to what happens pretty much everywhere else on earth: the sun warms the ground, which warms the air above it, creating a rising column of air. The difference is that outside of the greenhouse, the heat can spread in a column a mile high, but inside the greenhouse, the warming is confined in a space about 20 feet high, creating a much warmer environment.
Staying Warm All Night
At night, the temperature drops outside the greenhouse. This cools the windows down immediately. The air inside a greenhouse is moist, so when the windows cool, water condenses on the inside of them. This water provides an additional barrier, helping trap heat inside the greenhouse. The floor and the objects inside the greenhouse are still warm, so as heat leaks out through the windows, they release heat. This helps to keep the air temperature inside the greenhouse fairly stable. It will decrease somewhat during the night but not nearly as much as the outside temperature.