I had heard that Mars once had a planetary magnetic field, but that it is now gone? What happened to it?
$\begingroup$ We don't even know (by sure) why Earth does have a magnetic field, so it's hard to figure out why a planet lost it. Only speculation. Wikipedia: "The Earth's magnetic field is believed to be generated by electric currents in the conductive iron alloys of its core, created by convection currents due to heat escaping from the core. " $\endgroup$– jumpjackSep 26, 2020 at 10:00
Our own magnetic field is generated by convection currents in Earth's liquid outer core.
A useful summary from Physics.org:
Differences in temperature, pressure and composition within the outer core cause convection currents in the molten metal as cool, dense matter sinks whilst warm, less dense matter rises.
This flow of liquid iron generates electric currents, which in turn produce magnetic fields.
The spiralling caused by the Coriolis force means that separate magnetic fields created are roughly aligned in the same direction.
Mars used to have a liquid iron core, but it was never as extensive as Earth's and has long since solidified.
Once our own core cools enough to solidify, we too will lose our magnetic field.
$\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$– called2voyage ♦Sep 28, 2020 at 12:54