  We investigate the formation of ultra-diffuse galaxies (UDGs) using the
Auriga high-resolution cosmological magneto-hydrodynamical simulations of Milky
Way-sized galaxies. We identify a sample of $92$ UDGs in the simulations that
match a wide range of observables such as sizes, central surface brightness,
S\'{e}rsic indices, colors, spatial distribution and abundance. Auriga UDGs
have dynamical masses similar to normal dwarfs. In the field, the key to their
origin is a strong correlation present in low-mass dark matter haloes between
galaxy size and halo spin parameter. Field UDGs form in dark matter haloes with
larger spins compared to normal dwarfs in the field, in agreement with previous
semi-analytical models. Satellite UDGs, on the other hand, have two different
origins: $\sim 55\%$ of them formed as field UDGs before they were accreted;
the remaining $\sim 45\%$ were normal field dwarfs that subsequently turned
into UDGs as a result of tidal interactions.
