A considerable number of animals, including bacteria, arthropods, molluscs and mammals are known to be able to sense magnetic fields.
For some varieties of bacteria, known as Magnetotactic bacteria, the ability is now quite well explained. But for mammals and birds, for example, there are currently no agreed explanations.
“The largest issue affecting verification of an animal magnetic sense is that despite more than 40 years of work on magnetoreception there has yet to be an identification of a sensory receptor. Given that the entire receptor system could likely fit in a one-millimeter cube and have a magnetic content of less than one ppm, it is difficult to discern the parts of the brain where this information is processed.”
See Magnetoreception at Wikipedia.
Although there have been a large number of controlled studies intended to determine (or refute) the existence of magnetoreception in humans, the results have not been conclusive.
A 2019 study from Caltech and the University of Tokyo, however, appears to show marked differences in measurements of human brain 'alpha waves' in differing geomagnetic fields. It's important to note that the experimental subjects were not necessarily aware of the changes.
See Transduction of the Geomagnetic Field as Evidenced from alpha-Band Activity in the Human Brain.
The report paper on the research ends :
Given the known presence of highly-evolved geomagnetic navigation systems in species across the animal kingdom, it is perhaps not surprising that we might retain at least some functioning neural components especially given the nomadic hunter/gatherer lifestyle of our not-too-distant ancestors. The full extent of this inheritance remains to be discovered.
Also see: Pigeon navigation