It is the ozone layer, that needs to be protected, so it can protect us against UV radiation (photons).
It is very important to understand that solar wind is made up by:
electrons
protons
alpha particles
The solar wind is a stream of charged particles released from the upper atmosphere of the Sun, called the corona. This plasma consists of mostly electrons, protons and alpha particles with kinetic energy between 0.5 and 10 keV.
https://en.wikipedia.org/wiki/Solar_wind
Now the magnetic field of the Earth, which is produced by the liquid outer iron core (electric currents) of the Earth, extends to space beyond the ionosphere.
https://en.wikipedia.org/wiki/Earth%27s_magnetic_field
The magnetosphere is the region above the ionosphere that is defined by the extent of the Earth's magnetic field in space. It extends several tens of thousands of kilometers into space, protecting the Earth from the charged particles of the solar wind and cosmic rays that would otherwise strip away the upper atmosphere, including the ozone layer that protects the Earth from harmful ultraviolet radiation.
Now the reason we need the magnetosphere is because it protects the ionosphere. Why? Because the ionosphere includes the mezosphere.
The ionosphere (/aɪˈɒnəˌsfɪər/1[2]) is the ionized part of Earth's upper atmosphere, from about 60 km (37 mi) to 1,000 km (620 mi) altitude, a region that includes the thermosphere and parts of the mesosphere and exosphere.
https://en.wikipedia.org/wiki/Ionosphere

Now why do we need the mezosphere? Because it protects the stratosphere, that includes the ozone layer.
The lowest part of the Earth's atmosphere, the troposphere extends from the surface to about 10 km (6.2 mi). Above that is the stratosphere, followed by the mesosphere. In the stratosphere incoming solar radiation creates the ozone layer.
Now if all the radiation (charged particles) would be deflected, then we would not have an ozone layer, and we would not be protected from UV radiation.
Ultraviolet (UV), X-ray and shorter wavelengths of solar radiation are ionizing, since photons at these frequencies contain sufficient energy to dislodge an electron from a neutral gas atom or molecule upon absorption. In this process the light electron obtains a high velocity so that the temperature of the created electronic gas is much higher (of the order of thousand K) than the one of ions and neutrals. The reverse process to ionization is recombination, in which a free electron is "captured" by a positive ion. Recombination occurs spontaneously, and causes the emission of a photon carrying away the energy produced upon recombination. As gas density increases at lower altitudes, the recombination process prevails, since the gas molecules and ions are closer together. The balance between these two processes determines the quantity of ionization present.
It is very important to understand that the solar wind could strip away the ozone layer.
But your question is about the stripping away of the atmosphere, and why the solar wind does not do that. Now the solar wind exerts a pressure. If this pressure reached the atmosphere, it would strip it away.
Now the magnetosphere has a pressure too, and it counterbalances the pressure of the solar wind.
Earth's magnetic field, predominantly dipolar at its surface, is distorted further out by the solar wind. This is a stream of charged particles leaving the Sun's corona and accelerating to a speed of 200 to 1000 kilometres per second. They carry with them a magnetic field, the interplanetary magnetic field (IMF).[24]
The solar wind exerts a pressure, and if it could reach Earth's atmosphere it would erode it. However, it is kept away by the pressure of the Earth's magnetic field. The magnetopause, the area where the pressures balance, is the boundary of the magnetosphere. Despite its name, the magnetosphere is asymmetric, with the sunward side being about 10 Earth radii out but the other side stretching out in a magnetotail that extends beyond 200 Earth radii.[25] Sunward of the magnetopause is the bow shock, the area where the solar wind slows abruptly.
So the answer to your question is:
So basically the charged particles are making up the solar wind, but the pressure of the solar wind is what is important, and that the magnetosphere counterbalances it so the atmosphere is not stripped away.
It is the ozone layer that needs to be protected, to protect us from UV radiation.
Some of the charged particles do get into the magnetosphere. These spiral around field lines, bouncing back and forth between the poles several times per second. In addition, positive ions slowly drift westward and negative ions drift eastward, giving rise to a ring current.
The answer to your question is that most of the charged particles do get deflected.
After the comment, the question is more about the QM level explanation of how the pressure of the magnetosphere deflects the electrons, protons and alpha particles of the solar wind.
Now the magnetosphere has energy, and as the solar wind's particles reach the magnetosphere, the magnetic field of the Earth starts to interact with the solar wind's particles. This interaction is mediated by virtual photons.
Virtual photons are not real photons, they are off mass shell, though, they are a mathematical way of describing the interaction between the field and the solar wind's particles.
Now as the solar wind's particles interact with the magnetic field of the Earth, the magnetic field's energy is transferred to the solar wind's particles as kinetic energy and momentum, via virtual photons, thus the solar wind's particles trajectory, momentum changes so that they move away from the Earth.