When the light from the sun hits the earth, some of it is absorbed and warms the earth. The warm earth emits IR light, and most of it radiates away into space, but "greenhouse" gasses in the atmosphere absorb some of it, warming the atmosphere and effectively trapping some of the heat. Over time, this heat builds up. This is called the "greenhouse effect".