To explain why the compass needle points to magnetic north, there is only an assumption theory. It is called the standard bar magnet assumption theory. As per this theory, imagine earth to be having a big bar magnet buried deep inside as shown in the picture. Now the bar magnet’s south end is considered to be at the earth’s North Pole and north end at earth’s South Pole. We know that like poles repel and unlike poles attract. Thus, a freely suspended compass needle points to the earth’s magnetic North Pole getting attracted to the south end of the ‘imaginary’ bar magnet.