From what I understand, CMB is the left over radiation from the Big Bang. As all matter, including the Earth, was made during the Big Bang and then as the universe expanded that matter/energy got further and further apart, but as that matter can't move faster than the speed of light then we should be behind the CMB which travels at the speed of light. So from my understanding the CMB would have passed us and most of the matter of the universe a long time ago so we shouldn't be able to detect it. Also on a side note how is the CMB constant; shouldn't it be a flash? Sorry if the question doesn't make much sense. I am a student so please use layman's terms.
You are assuming the Big Bang happened at a point, so the CMB is a shell of radiation expanding outwards from that point. However the Big Bang happened everywhere so every point in the universe is a source of the CMB. The CMB radiation we are detecting today comes from regions of the universe that were about 13.8 billion light years away at the moment the CMB was emitted (those points are a lot farther away now).
The fact that the Big Bang happened everywhere is a difficult conceptual issue for non-physicists. See my answer to the question Was the singularity at Big Bang perfectly uniform and if so, why did the universe lose its uniformity? for a non-physicist friendly discussion of this.
A good analogue of how there does not exist a single point in our universe that is the unique point where the Big Bang happened is the expanding balloon . I will stretch it further to include the photon background:
Suppose that we have a solid ball of elastic very hot material, and somehow we can blow air at its center. The ballon forms and the surface starts expanding . Every point on the balloon surface was theoretically at the (0,0,0,0) point where the expansion started, so if you live on the balloon, all the points of the balloon were present at time=0 at the singular point.
Now suppose the balloon surface has a thickness : the distribution of matter will be uniform in the beginning then as it cools it will form random uniform lumps etc. Suppose the material as the balloon cools is photoluminescent, and suppose the top and bottom surfaces of the balloon are totally reflecting in photons.
Suppose that photoluminescence creates a pulse of photons at time=t within the whole balloon surface thickness, and turns off, a flash. The photons will be trapped going around and around between the balloon surfaces.
If we stretch the analogy even further and suppose it is mostly vacuum between the surfaces, after some expansion, the photons will become like a photon gas and if there is not enough matter to absorb them, their density will diminish as the expansion goes further, but it will be the same at all points between this hypothetical thickness of the balloon, and characteristic of the initial photoluminescence pulse.
A balloon surface observer will see that the density of photons diminishes with the expansion of the balloon and can form hypotheseis on the origin of these photons.
I hope the analogue above shows how a flash can produce photons that will keep on existing and be detectable in an expanding space time. In a sense the CMB photons are zooming around the closed universe continuously and we detect the properties of this relic radiation .
The universe is mostly empty space now. That is why we have the decoupling of radiation at around 380.000 years after the Big Bang because by then the expansion lowered the energy density enough that the photons did not find enough matter to rescatter or be absorbed by.