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