As the universe expands, the wavelength of the light stretches and so its vibrational frequency decreases. Because the frequency is proportional to the energy of the light, and the average energy determines the temperature, the temperature of the light drops with the expansion.

