  We study the effect of magnetic fields on a simulated galaxy and its
surrounding gaseous halo, or circumgalactic medium (CGM), within cosmological
'zoom-in' simulations of a Milky Way-mass galaxy as part of the 'Simulating the
Universe with Refined Galaxy Environments' (SURGE) project. We use three
different galaxy formation models, each with and without magnetic fields, and
include additional spatial refinement in the CGM to improve its resolution. The
central galaxy's star formation rate and stellar mass are not strongly affected
by the presence of magnetic fields, but the galaxy is more disc-dominated and
its central black hole is more massive when $B>0$. The physical properties of
the CGM change significantly. With magnetic fields, the circumgalactic gas
flows are slower, the atomic hydrogen-dominated extended discs around the
galaxy are more massive and the densities in the inner CGM are therefore
higher, the temperatures in the outer CGM are higher, and the pressure in the
halo is higher and smoother. The total gas fraction and metal mass fraction in
the halo are also higher when magnetic fields are included, because less gas
escapes the halo. Additionally, we find that the CGM properties depend on
azimuthal angle and that magnetic fields reduce the scatter in radial velocity,
whilst enhancing the scatter in metallicity at fixed azimuthal angle. The
metals are thus less well-mixed throughout the halo, resulting in more
metal-poor halo gas. These results together show that magnetic fields in the
CGM change the flow of gas in galaxy haloes, making it more difficult for
metal-rich outflows to mix with the metal-poor CGM and to escape the halo, and
therefore should be included in simulations of galaxy formation.
