The amount of carbon dioxide in the atmosphere is tiny, compared with nitrogen and oxygen, but besides feeding plants and poisoning animals it has another important function: that of controlling the atmosphere's temperature.
Actually the gases that do this are water vapor, carbon dioxide, methane, nitrous oxide, and ozone; and there are others, which either have weaker effect or are rarer.
The greenhouse substances are the ones that absorb and emit infrared radiation. What happens is that the visible part of sunlight passes down through them, but much of the infrared part does not. The rest of the light reaches the surface and warms it; the heat, turning into infrared radiation, goes back up and much of it does not get out into space.
This is like the glass of a greenhouse. Sunlight gets in through it and warms the air; the warmth, or most of it, cannot get out through the glass.
Water is in the atmosphere not only as vapor but as clouds (made of liquid droplets or of ice crystals). They reflect light directly back into space, so if there are more of them, the surface is cooler.
Taking into account effectiveness and abundance, water (as gas and as clouds) has the largest greenhouse effect. Carbon dioxide is next. Methane comes third; it is 25 times more effective than carbon dioxide, but there is less of it. Ozone is fourth.
The atmosphere is our blanket. The
greenhouse effect is in balance or was. Without these gases,
earth's temperature would be hugely colder. The air we live in now
averages about 14°C (57°F) not far below 20°C room temperature.
If the greenhouse gases were absent, the average would drop to about
-19°C that far below freezing.
Really, our planet is outside the habitable zone around its star, the zone where liquid water can exist because the temperature is above freezing and below boiling point; it is brought into that zone by the lucky properties of the atmosphere it has.