Eventually, the heat emitted by the earth due to sunlight rises and passes out into space. But before the energy passes back into space it is changed. The law says that if you have two objects at different temperatures, the one with the lower temperature will emit radiation at longer wavelengths than the other. An inverse relationship. High temperature means short wavelengths.
Low temperature means long wavelengths.
Infra-red radiation is what causes the heat you feel when you iron clothes or when you lean over a warm automobile engine. If you touch the iron or engine, the burn you get is not caused by the radiation, it is caused as heat is conducted directly to your skin, but that is a different story. The energy absorbed is trapped temporarily near the earth's surface by causing these molecules to vibrate more vigorously. As they vibrate, they radiate heat energy, but it is absorbed by other molecules nearby. Note what happens.