The solar wind and the northern lights

The Sun has a magnetic field.

The wind from the Sun carries off some of this magnetic field into space.

The Earth has a magnetic field as well, and this manages to push away the solar wind. Imagine paddling in the sea when a (small) wave comes towards you. You'll see the water flowing around your legs, and this similar to how the solar wind flows around the Earth.