Why do the magnetic field lines of the earth go from south pole to north pole? I saw these figures and could not get why the magnetic field lines are not pointing from the north pole towards the south pole but they do the opposite.



Or also this picture which is about magnetic characteristics of the sun says the same thing:
That was a curiosity that I also had once. 
The reason for that is that the magnetic pole near earth's geographic north pole is actually the south magnetic pole.
You can find a more detailed answer on https://wtamu.edu/~cbaird/sq/2013/11/15/why-does-a-magnetic-compass-point-to-the-geographic-north-pole/

Happy Thanksgiving!