It is very important to understand that heat energy is stored in the degrees of freedom of molecules.
Heat energy, at a microscopic level, is stored in the degrees of freedom of atoms and molecules. These degrees of freedom are translational, rotational and vibrational. They all store different amounts of energy, depending on the geometry of the atom. Translational degrees of freedom are the atom or molecule moving around in space, and there are always 3 for the 3 dimensions of space. The rotational and vibrational modes come from the geometry of the atom/molecule.
How is heat represented on a quantum level?
Now there are mainly three types:
- translational
Translational degrees of freedom arise from a gas molecule's ability to move freely in space.
- rotational
A molecule's rotational degrees of freedom represent the number of unique ways the molecule may rotate in space about its center of mass which a change in the molecule's orientation.
- vibrational
The number of vibrational degrees of freedom (or vibrational modes) of a molecule is determined by examining the number of unique ways the atoms within the molecule may move relative to one another, such as in bond stretches or bends.
https://en.wikibooks.org/wiki/Statistical_Thermodynamics_and_Rate_Theories/Degrees_of_freedom
Now you are asking, why do certain wavelength photons heat up certain materials' molecules only while others cannot?
Every molecule has its own quantum mechanical characteristics, which includes the translational, vibrational and rotational modes' characteristics, and what wavelength photons those can correspond to. This means that certain wavelength photons energy needs to match the energy gap between those modes.
If the energy of the photon matches (or sometimes is exceeding) the gap between two modes, then the photon might be absorbed with high probability.
Now it is not just that simple. Certain wavelength photons do have the ability to transfer their energies with higher probability to molecules that have a certain type of available degrees of freedom (mode).
Thus, certain molecules that have degrees of freedom available in the different translational, vibrational or rotational modes, can be excited by different wavelength photons.
Just a note, the other answers do not address this, but heating a material is contrary to popular belief not only mainly by absorption. A lot of photons' energy is transferred by inelastic scattering. In this case, the photon does not cease to exist, and only transfers part of its energy to the molecule.
https://en.wikipedia.org/wiki/Inelastic_scattering