I had heard that Mars once had a planetary magnetic field, but that it is now gone? What happened to it?
Our own magnetic field is generated by convection currents in Earth's liquid outer core.
A useful summary from Physics.org:
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.