First, the wavelength of the laser (think of it as the "color" of the laser) is chosen such that the energy of the photons is just under the energy state of the atoms that you are trying to cool.
Now, when the atom is moving toward the source of the laser, this causes the atom to "see" a higher energy. This is called Doppler shift and is a very well-known effect in anything that emits waves and is moving. In fact, you've experienced it before when you hear a car horn -- as it moves towards you it has a higher pitch and as it moves away from you it has a lower pitch.
So, for atoms moving toward the source the see the energy rise just enough to absorb the photon and move to a higher energy state. Inevitably, the atom will want to move to a lower energy state (as all matter does) and will end up ejecting a new photon in a random direction. In order to maintain the conservation of momentum, this means that the photon will likely be ejected in a way that counteracts the direction it was previously moving, effectively slowing it down. Since heat is a measure of how fast atoms are moving, this means that atom has cooled down.
For atoms moving away from the laser source, they are unable to absorb the photons because the Doppler shift acts in the opposite direction, and they are completely unable to absorb the photons.
So as a result of all this, it is possible to slow down atoms moving in a very specific direction, without affecting the other atoms. This means you can systematically slow atoms down which means you can systematically cool things down.
Edit: Here's a piped link to the youtube video above in case you're privacy-conscious, however, Dianna (aka Physics Girl) has been bed-ridden with Long COVID for a while now so it would be great if you could contribute to her Patreon in lieu of the ad revenue