Magnetic fields are observed on virtually all length scales of the modern Universe, from planets and stars to galaxies and galaxy clusters. Observations of blazars suggest that even the intergalactic medium is permeated by magnetic fields. Such large-scale fields were most likely generated very shortly after the Big Bang and therefore are a unique window into the physics of the very early Universe.
In my talk, I will review theoretical models of magnetogenesis and confront these with observational constraints. I will address the possible origin of magnetic fields in the very early Universe, during inflation and the cosmological phase transitions, as well as their pre-recombination evolution in magnetohydrodynamical (MHD) turbulence. In particular, I will present new results from high-resolution numerical simulations that show an efficient amplification of magnetic energy due to the so-called chiral anomaly, a standard model effect that necessarily leads to an extension of the MHD equations at high energies.