Bonds that are larger and looser tend to vibrate at lower frequencies than those that are small and tight. This rule of thumb applies both to classical mechanical systems and to quantum transitions, and so it “explains” why CO2 tends to respond to longer wavelengths than O2 and N2 (and much longer than those required to change the energy levels of electrons within those molecules).
The measured locations and widths of the corresponding absorption bands fit very closely with calculations based on quantum and statistical mechanics, so it can reasonably be said that we understand very well why they are where they are.
It is, however, just a fluke that the vibrational excitation modes of CO2 (and H2O and CH4) happen to fall near the peak intensity of thermal radiation at the Earth’s temperature of around 300K. (And they might be less effective than other choices as “greenhouse gases” on a planet that was either white hot or not illuminated by the Sun.)