Why do cosmic rays slow down when passing through the CMB? When cosmic rays pass through space, they slow down. But why? The energy of the photons that hit these particles couldn't just be transferred to it, making it go even faster?
In other words: Why cosmic rays lose energy (thus speed) when photons from the CMB collides with it?
I would appreciate the help!
PS.: I'm not a physicist nor expert. Just a beginner who likes astrophysics. So if I said something stupid, please correct me.
 A: There is also the inverse Compton effect playing a role here. On their way through the galaxy, cosmic rays interact with the microwave background by the so-called inverse Compton scattering (Sarazin and Lieu 1998). This effect transfers energy from particles to photons.
It is most efficient for low-mass particles and eventually leads to under-representation of galactic electrons and positrons. Therefore, most of the cosmic rays that arrive in our solar system are (heavier) protons.
Related question: What happens to the electron companions of cosmic ray protons?
A: It has to do with something called the Doppler effect. Looking at it from the cosmic ray's point of view, the light it hits head on has a really high energy, and the light that hits it from behind is even colder/lower energy than what we see ($2.7$ Kelvin).
If you want to stick to our point of view, then yes a photon hitting it from behind would boost it, but when you balance out the conservation of energy and momentum the head on hit takes away far more energy than the rear-ending gives. The way the math works on those conservation laws, it's basically changing perspective to the person who sees the cosmic ray and photon having the same momentum in opposite directions ("center of mass" frame), seeing what happens, and then translating back to our perspective. When the cosmic ray is being hit from behind there is very little energy left in either the photon or the cosmic ray after the change in perspective. When they hit head on, though, there is also less energy, overall, but far more than in the other case. This happens because in both cases the change in perspective needed is to be moving almost as fast as the cosmic ray in the same direction. By the Doppler effect, this will boost the frequency of the head on photon, and further reduce that of the rear-end collision photon.
This becomes really important when there's enough energy in the center of momentum frame to start doing something called pair production. For every type of particle the cosmic ray has enough energy to produce with the CMB, the faster it will lose energy to collisions with it. There is even a hypothesis that the distance cosmic rays can travel above a certain kinetic energy is severely limited by the fact that they should produce pions when it runs into the CMB. The name for this limit is the GZK cutoff. If you want to know why that is the limit, and not the production of electron-positron pairs, muon-anti muon pairs, or some other process, I don't know those details.
A: Sean E. Lake's answer is excellent, and should be the accepted answer. I just wanted to provide an alternative way of seeing the same thing.
Thermal equilibrium
When particles interact, they exchange energy. This tends to bring an ensemble of interacting particles in thermal equilibrium, where each particle has the same distribution of energies, no matter the type.
CMB photons are very low-energetic. They arise from the recombination of hydrogen, and have even been redshifted since that epoch, so their energies are of the order $10^{-3}\,\mathrm{eV}$. On the other hand, the energy of cosmic rays — which probably originate in supernovae and AGN — is measured in GeV and up (the fastest cosmic ever detected had an energy of $3\times10^{20}\,\mathrm{eV}^\dagger$).
Thus, the energy of cosmic rays is much, much higher than that of the CMB, and the interaction between the two is bound, on average, to reduce the energy of the cosmics.

$^\dagger$"…which meant it packed the kinetic energy of a baseball — in a single proton" (Randall Munroe, 2012).
