It's difficult to answer without knowing exactly how much you've seen about the Dirac equation and the fermion Lagrangian that it follows from.
Step by step, we have g, the coupling constant, which is a number that determines the strength of the interaction. If we are talking about the electromagnetic interaction, this is [tex]q e[/tex], where [tex]e[/tex] is the fundamental electric charge and [tex]q[/tex] is the quantized charge of the fermion. For example, if the fermion is an electron, then [tex]q_e=-1[/tex], for a proton [tex]q_p=+1[/tex], while for an up quark [tex]q_u=+2/3[/tex].
B represents the bosonic gauge field, but it typical to express this as a 4-vector [tex]B_\mu[/tex]. When we are talking about electromagnetism, it's typical to denote the gauge field as [tex]A_\mu[/tex]. Classically, the time component is equal to the scalar potential [tex]A_0 = \Phi[/tex], while the space components correspond to the vector potential [tex]A_i =- \vec{A}[/tex]. The usual gauge invariance of electrodynamics is that
[tex]\Phi \rightarrow \Phi + \frac{\partial \alpha}{\partial t},~~~ \vec{A} \rightarrow \vec{A} - \nabla \alpha,[/tex]
which can be expressed in terms of 4-vectors as
[tex]A_\mu \rightarrow A_\mu + \partial_\mu \alpha. (*)[/tex]
In quantum field theory, [tex]A_\mu[/tex], or more generally any gauge field [tex]B_\mu[/tex] is promoted to a quantum field operator. In the absence of any other fields, the components of [tex]B_\mu[/tex] do satisfy the Klein-Gordan equation, but in the presence of the fermionic field that you're considering, the correct equation is
[tex]\Box A_\mu = -g j_\mu,[/tex]
where [tex]j_\mu[/tex] is the fermionic current.
Now the fermionic current is the generalization of the electric current in electromagnetism. More properly, this is a current density, while
[tex]J^\mu = \int d^3x j^\mu[/tex]
is what we'd usually call a current in classical electrodynamics. The time component [tex]j^0[/tex] corresponds to a charge density, while the spatial components are a current density. In terms of the fermion field [tex]\phi[/tex] that satisfies the Dirac equation
[tex](-i\gamma^\mu \partial_\mu +m)\psi =0[/tex], we can express the fermionic current as
[tex]j^\mu = \bar{\psi}\gamma^\mu \psi.[/tex]
The relationship to the gauge principle is the following. The Lagrangian corresponding to the Dirac equation is
[tex]L_D = i \bar{\psi} \gamma^\mu \partial_\mu \psi - m \bar{\psi}\psi[/tex]
Under a gauge transformation
[tex]\psi \rightarrow e^{i g\alpha} \psi,~~\bar{\psi} \rightarrow \bar{\psi}e^{-ig\alpha},[/tex]
so we see that
[tex]L_D \rightarrow L_D -( \partial_\mu \alpha) (g j^\mu)[/tex]
It is therefore possible to show that the Lagrangian
[tex]L_D + g B_\mu j^\mu[/tex]
is gauge invariant provided that
[tex]B_\mu \rightarrow B_\mu + \partial_\mu \alpha[/tex]
under a gauge transformation (compare with (*) above for electrodynamics). So the term [tex]g B_\mu j^\mu[/tex] represents the correct, gauge-invariant interaction between the fermion and the gauge field [tex]B_\mu[/tex].