A greenhouse is used to raise the temperature in a controlled environment during the day, and maintain a relatively warmth during the night. It can be important in keeping the temperature high over cold nights preventing plants from being damaged by getting too cold.
The method by which a greenhouse works is simple and easily understood. The construction requires transparent windows. Light freely enters and strikes surfaces, including plants, tables, and the ground. Solid objects absorb some light, and reflect the rest. The absorbed light is shared by the molecules of the solid, including some below the surface. When a solid reemits its energy there is less per molecule to emit, so it emits lower energy infrared frequencies over a longer period of time.
To understand better how a greenhouse works look at a window, then look at a mirror. Notice that one passes light, and the other reflects light. Well, windows act as mirrors for infrared frequencies, so the waves of infrared coming from within the greenhouse get reflected back. The energy does not efficiently escape. Light entering, then being emitted back after the energy is in the infrared part of the spectrum allows energy to build in the day, then have a slow release, even at night.
Trapped energy causes a temperature rise. It is reabsorbed by the solids, raising the temperature, then through contact heats the air. And some is also absorbed directly by the air.