Video 15. Deriving the qED Lagrangian by Dietterich Labs (2018) Source.
As mentioned at the start of the video, he starts with the Dirac equation
Lagrangian derived in a previous video. It has nothing to do with electromagnetism
However, it does not have a local invariance if the
transformation depends on the point in spacetime.
To fix that, he adds an extra gauge field
(a field of
matrices) to the regular derivative, and the resulting derivative has a fancy name: the covariant derivative
So he uses that as the gauge, and also adds in the Maxwell Lagrangian
in the same go. It is kind of a guess, but it is a natural guess, and it turns out to be correct.