This is a natural process, which keeps the earth warm. Greenhouse gases (carbon dioxide, methane, nitrogen) trap some of the heat that is radiated from the surface which would have been lost into space. Without this the temperature of the earth would be a lot cooler