The term and idea was first introduced initialized by Hermann Weyl when he was working on combining electromagnetism and general relativity to formulate Maxwell's equations in curved spacetime in 1918 and published as Gravity and electricity by Hermann Weyl (1918). Based on perception that symmetry implies charge conservation. The same idea was later adapted for quantum electrodynamics, a context in which is has even more impact.
A random field you add to make something transform locally the way you want. See e.g.: Video "Deriving the qED Lagrangian by Dietterich Labs (2018)".