In the form of light waves, or "rays," the sun sends a lot of heat and light to Earth every day. But most of these rays go to waste because we don't have many good ways to capture and store them.
Greenhouses store these rays by taking advantage of a very simple fact about science. Basically, if you make a building out of glass, the sun's rays can get through the glass and into the building, but once they're inside, they can't get out.
This happens because of the way glass is made. Light can pass through it, but air can't. When the sun's rays get into the greenhouse, they heat the air, soil, rocks, plants, and other things inside, which then keep the heat. Since the heat that has been absorbed by the air and objects can't just get out again, the greenhouse gets gradually hotter as more and more heat is trapped inside.
One hot day can keep a greenhouse warm for several days, and even a normal day is enough to keep it warm overnight.
Even when it's cold outside, the plants inside the greenhouse can grow and feed themselves by using the heat that has been stored inside. When it's warm outside, the temperature inside a greenhouse will rise much higher than the temperature outside. This means that you can grow plants like exotic fruits and flowers that would normally only grow in a more tropical climate than the one where you live.
But because of how greenhouses work, you should be careful about how often you go inside. When you open the door, a lot of heat will go out, so if you go in there every day, the greenhouse will be almost useless. Even though it might be tempting to go in and check on your plants, they will do much better if you plant them and then leave them alone (you can look at them through the windows if you have to) and only go in to water them very rarely.