The Sun continuously releases a stream of charged particles known as the solar wind. These particles travel through space and interact with the Earth's magnetic field. The Earth's magnetic field is strongest at the poles, so the solar wind particles are concentrated in these regions.
When the solar wind particles reach the Earth's atmosphere, they collide with atoms and molecules of gases such as oxygen and nitrogen. These collisions excite the atoms and molecules, causing them to emit light of various colors. The color of the aurora depends on the type of gas particles that are excited.
So, the northern lights are ultimately caused by the interaction between the solar wind particles and the Earth's magnetic field, rather than being directly caused by particles from the Sun.