Anything that has a temperature above absolute zero radiates some of its thermal energy as electromagnetic radiation. Basically, everything is in the process of trying to cool off. And yet we have not cooled off to absolute zero. There is this pesky star relatively nearby that bombards us with sunlight every day. It keeps replenishing our radiant cooling.
The wavelengths of radiation depend on the chemical makeup and temperature of the source. When that radiation reaches another object, some wavelengths pass through, some are reflected, and the rest are absorbed and converted back to thermal energy.
Earth receives sunlight. Some of it reflects back to space, some of it is absorbed in the atmosphere, and some of it is absorbed by the planet.
Earth radiates energy. Some of it escapes to space; the rest is absorbed by the atmosphere or the planet again.
The atmosphere radiates energy. Some of it escapes to space; the rest is absorbed by the planet or the atmosphere again.
Having an atmosphere adds an absorption, reflection, and radiation layer around the planet. Without an atmosphere, the radiation from a planet is able to escape more easily, and the equilibrium temperature it reaches is lower than it would be with an atmosphere. Estimates for the greenhouse effect from Earth having an atmosphere is 40° F to 60° F warmer than it would be without one.