Covariant derivative in field theory I'm reading Physics from Symmetry by Jakob Schwichtenberg and in Chapter 7 equation 7.18 he introduces the covariant derivative when deriving the interaction Lagrangian density for the spin-$\frac{1}{2}$ and the spin-1 field:
$$
D_\mu = i\partial_\mu + g A_\mu 
$$
I want to know why is this called the covariant derivative and what does it have to do with the covariant derivative as seen in differential geometry?
 A: Assume that $M$ is the spacetime manifold, and for every $x\in M$ point there is a  vector space $E_x$, so we get a family of vector spaces $x\mapsto E_x$ parametrized by the manifold points.
If all vector spaces are isomorphic, and this construction satisfies certain axioms I don't want to list here, then the system $(E,\pi,M)$ is called a vector bundle over $M$, where $E=\sqcup_{x\in M}E_x$ is the unification of all the individual spaces, and $\pi:E\rightarrow M$ is a smooth surjective map of constant rank, called the projection (or the fibration). It is such that $\pi(E_x)=x$, eg. all elements of $E$ are projected to the point of $M$ they are located at.
A linear field on $M$ is a section of the vector bundle $\pi:E\rightarrow M$, eg. it is a map $\psi:M\rightarrow E$ such that $\pi\circ\psi=\text{Id}_M$, eg. the image $\psi(x)$ is projected back to $x$. The space of all sections over $M$ is denoted as $\Gamma_M(\pi)$.
If the $x^\mu$ are some base coordinates, then on the vector bundle, one can set up local coordinates of the form $(x^\mu, u^a)$, where the allowed change of coordinates that leaves the base coordinates $x^\mu$ intact are of the form $(x^\mu,u^a)\mapsto(x^\mu, \Lambda(x)^a_{\ b}u^b)$, eg. linear.
If $\psi\in\Gamma_M(E)$ is a section, then under the coordinate functions we have $$ x^\mu(\psi(x))=x^\mu \\ u^a(\psi(x))=\psi^a(x) $$ for some local functions $\psi^a(x)$, which are called the components of $\psi$ in this coordinate system (the $u$-coordinates in this context are also referred to as a local trivialization (LT) of $\pi:E\rightarrow M$).
From the above, it is clear that under an LT, the components of a section change as $\psi^a(x)\mapsto \psi^{\prime a}(x)=\Lambda(x)^a_{\ b}\psi^b(x)$.
Note that $\Lambda$ is a matrix taking values in $\text{GL}(k,\mathbb R)$ for some $k$, but if all changes of LTs are mediated by matrix functions that take vlaues in some $G<\text{GL}(k,\mathbb R)$ Lie subgroup, then the vector bundle is called a $G$-vector bundle.

The point is for separate points $x,y\in M$, we have $\psi(x)\in E_x$ and $\psi(y)\in E_y$, which are different vector spaces, so the two values cannot be compared. Indeed, if we compare them in a LT, we get $\psi^{\prime}(x)=\Lambda(x)\psi(x)$ and $\psi^\prime(y)=\Lambda(y)\psi$ (suppressing indices), and the transformations $\Lambda(x)$ and $\Lambda(y)$ are different in general, so for example if in one LT the values at $x$ and $y$ are the same, then after a change of LT, they won't be anymore.
This gives us problems if we wish to define derivatives of sections that themselves behave "nicely". For to take derivatives, we need to compare the values at different points (infinitesimally separated points).
So we introduce the following. If $\psi(x)=(\psi^a(x))$ are field components in some LT at $x$, then if we move from $x$ to $x+dx$, and we wish to carry the field value with us to this point (so-called parallel transport), then we can ordain that the infinitesimal first-order change in the field components is given by $\delta\psi=-A_\mu(x)\psi(x) dx^\mu$, where $A_\mu(x)\in\mathfrak g$ takes values in the Lie algebra of $G$ (in this ad-hoc infinitesimal formalism it is fairly difficult to see why it should be Lie algebra valued, however upon deeper analysis, it is revealed that this is required to be compatible with the $G$-structure).
Then we define the covariant differential of $\psi$ to be $$ D\psi(x)=\psi(x+dx)-(\psi(x)+\delta\psi(x))=\psi(x+dx)-\psi(x)+A_\mu(x)\psi(x)dx^\mu=d\psi(x)+A_\mu(x)\psi dx^\mu, $$ from which one obtains $$ D_\mu\psi=\partial_\mu\psi+A_\mu\psi. $$ Then one can show that if under a change of LT $A$ transforms as $$ A_\mu^\prime=\Lambda A_\mu\Lambda^{-1}+\Lambda\partial_\mu(\Lambda^{-1}), $$ then under a change of LT, the covariant derivative $D_\mu\psi$ will transform the same way as $\psi$ does.

If you replace $E_x$ with $T_xM$, the tangent space of $M$ at $x$, $\pi:E\rightarrow M$ with $\pi_{TM}:TM\rightarrow M$, the tangent bundle of $M$, and the $\psi\in\Gamma_M(\pi)$ section with a vector field $Y\in\mathfrak X(M)$, and the $A_\mu$ field with $\Gamma_\mu=(\Gamma^{\alpha}_{\ \ \beta})_\mu$, then you obtain the covariant derivative used in GR.
Essentially, in both cases, the covariant derivative is a tool that allows you to infinitesimally identify nearby fibers of a vector bundle. It's just in gauge theories, the vector bundle is some externally imposed construct in which the matter field lives, while in GR, it is the tangent bundle itself.
