However, as the temperature rises, more energy gets through the window glass. Finally, a balance point is reached at which the amount of sunlight energy that is being absorbed is just balanced by the amount of heat energy that escapes in the form of infrared. At this point, the inside of the car reaches a stable temperature. The same kind of balancing goes on with the earth. You can think of the earth's atmosphere as playing roughly the same role as the glass in the car window.
Sunlight can easily pass through the atmosphere.
About a third of the sunlight is immediately reflected back out into space by light colored surfaces such as clouds, sand, snow, and ice. Most of the rest is absorbed by darker surfaces. If this were the whole story, the earth's surface would keep heating up and soon we would all fry. To reach a balance, the energy that is absorbed must somehow get back out into space as infrared heat energy. Water vapor, ozone, carbon dioxide, and several other natural and man-made gases in the atmosphere, all absorb infrared energy, so infrared energy has trouble getting out to space.