Earth’s magnetosphere is the space around our planet where the dominant magnetic field is magnetic field of Earth (geomagnetic field). This field originates from the motion within the liquid outer core of Earth.
Imagine a bar magnet placed in the centre of Earth and tilted around 11º from the planet’s rotational axis. The geomagnetic field lines created by such a dipole intersect the Earth’s surface at the North and South Geomagnetic Poles, which are located (as of 2017) at 80.5°N, 72.8°W and 80.5°S,107.2°E, respectively.
If the geomagnetic field were the only magnetic field present in space, it would extend into infinity, getting weaker with increasing distance from Earth. However, as the sun emits a solar wind into the solar system, it exerts pressure on the magnetosphere and affects its shape, making it a closed space that is compressed on the dayside part and elongated on the nightside.
The boundary between the magnetosphere and solar wind is called the magnetopause. It is constantly in motion as the speed of the solar wind changes.