The Universe isn’t a static place. Although the laws of nature (physics, chemistry, biology, etc.) don’t appear to change over time, everything in the Universe appears to evolve, and changes over time. One of the simplest ways that this happens is through Hubble expansion.
General relativity tells us how the Universe expands, and more specifically, it tells us that the expansion rate (which we call the Hubble constant, H0) is related to the total energy density of the Universe. More matter density: faster expansion. Greater density of photons (i.e., light): faster expansion. More of any and all types of energy (even the mysterious dark energy): the expansion rate is faster.
The weird thing is, it isn’t just that the density of stuff causes the expansion rate to be what it is. Because the Universe is expanding, the energy density of everything in it is changing. If we know what the energy density of all the stuff in the Universe is at any one moment, we can reconstruct the entire expansion history of the Universe, from the big bang until as far into the future as we like:
We can also figure out how things like the matter density changed over time. As space expands, the volume of the universe increases, and we know that matter density dilutes inversely proportionate to volume. That is, as the volume goes up by a factor of eight, the matter density becomes one-eighth of what it previously was. But photons, also known as light or radiation, do something extra. Matter, remember, is just ordinary junk, like my significant other’s car’s transmission. But light is a wave, and when the Universe expands, the light’s wavelength expands with it, like so:
Now, when light has different wavelengths, it has different properties, including different Energies. Gamma rays are the most energetic and have the shortest wavelengths; radio waves are the least energetic and have the longest wavelengths. (In fact, radio waves have so little energy that when you jump into a swimming pool, that expends more energy than is present in all the radio waves ever received on Earth!) Energy is also inversely related to wavelength:
So now, let’s combine these two things we know about the expansion of the Universe: as the Universe expands the Volume of it increases, and the wavelengths of all the light in it also increase. This means that the Universe was hotter in the past, and will be colder in the future. This means that if the volume of the Universe increases by a factor of eight, the energy density of photons is one-sixteenth of its initial value, not one-eighth like matter.
At some point in the past, the Universe was so hot that neutral atoms couldn’t form! Whenever a proton and and electron combined to form neutral hydrogen, a photon would run into it, and would be so energetic that it would knock the electron out of the atom. The Universe was so hot that it did this continuously for the first 380,000 years of its existence. But because it expanded and cooled, eventually the photons lost so much energy that they couldn’t keep all the atoms ionized, and they became neutral.
When the atoms became neutral, the photons became free to travel through space without running into unbound protons and electrons. This leftover radiation from the early universe is what we see as the cosmic microwave background today.
But why is it a microwave background? Well, when the Universe first became neutral, most of those photons were only a little bit too red to be visible, and there were a bunch that were visible light, and even some that were ultraviolet light (those are the ones that kept the Universe ionized for so long). But the Universe has expanded by a factor of over 1,000 on each side since then, meaning that every single one of those photons is a factor of over 1,000 less energetic. That means the photons which used to be ultraviolet are now near- and mid-infrared, the ones which used to be visible are now far-infrared, and it means that the radiation which was once infrared (which was most of them) are now in the microwave. Hence, today we have a cosmic microwave background. It also means that, billions of years from now, as the Universe continues to expand, the microwave background will continue to shift, eventually becoming a cosmic radio background. How neat is that?