The “greenhouse effect” is named by analogy to greenhouses. The greenhouse effect and a real greenhouse are similar in that they both limit the rate of thermal energy flowing out of the system, but the mechanisms by which heat is retained are different. A greenhouse works primarily by preventing absorbed heat from leaving the structure through convection, i.e. sensible heat transport. The greenhouse effect heats the earth because greenhouse gases absorb outgoing radiative energy and re-emit some of it back towards earth.
A greenhouse is built of any material that passes sunlight, usually glass, or plastic. It mainly heats up because the Sun warms the ground inside, which then warms the air in the greenhouse. The air continues to heat because it is confined within the greenhouse, unlike the environment outside the greenhouse where warm air near the surface rises and mixes with cooler air aloft. This can be demonstrated by opening a small window near the roof of a greenhouse: the temperature will drop considerably. It has also been demonstrated experimentally (R. W. Wood, 1909) that a “greenhouse” with a cover of rock salt (which is transparent to infra red) heats up an enclosure similarly to one with a glass cover. Thus greenhouses work primarily by preventing convective cooling.
In the greenhouse effect, rather than retaining (sensible) heat by physically preventing movement of the air, greenhouse gases act to warm the Earth by re-radiating some of the energy back towards the surface. This process may exist in real greenhouses, but is comparatively unimportant there.