That is, we can change the phase by a different amount at each point in spacetime and the physics will remain unchanged. This local phase symmetry is bigger than the global one. We know that the absolute square of the wavefunction is the same, but what about the Schroedinger equation. It must also be unchanged. A little calculation shows that the equation remains unchanged if we also transform the potentials This is just the standard gauge transformation of electromagnetism, but, we now see that local phase symmetry of the wavefunction requires gauge symmetry for the fields and indeed even requires the existence of the EM fields to cancel terms in the Schroedinger equation.
Electromagnetism is called a gauge theory because the gauge symmetry actually defines the theory.
It turns out that the weak and the strong interactions are also gauge theories and, in some sense, have the next simplest possible gauge symmetries after the one in Electromagnetism. We will write our standard gauge transformation in the traditional way to conform a bit better to the textbooks. There are measurable quantum physics consequences of this symmetry. We can derive the quantization of magnetic flux by calculating the line integral of in a field free region. Magnetic flux is excluded from the superconducting region.