The Lagrangian provided is Maxwell's Lagrangian, supplemented by a gauge fixing term:
$$\mathcal{L}=-\frac{1}{4}F_{\mu\nu}F^{\mu\nu} - \frac{1}{2}(\partial_\mu A^\mu)^2$$
The equations of motion are,
$$\partial_\mu F^{\mu\nu} + \partial^\nu (\partial_\mu A^\mu) = \partial_\mu \partial^\mu A^\nu = 0$$
Instead of making a gauge fixing procedure a posteriori, a term is added to the Lagrangian so that the gauge fixing condition arises naturally from the equations of motion. The reason we are at liberty to impose such a condition is because of the gauge symmetry under a transformation,
$$A_\mu \to A'_\mu=A_\mu + \partial_\mu \epsilon(x)$$
for an arbitrary function $\epsilon(x)$. If we choose to identity $A_\mu$ with $A'_\mu$, then we can always take a 4-potential and make it satisfy $\partial_\mu A^\mu = 0$ (Lorenz gauge) providing we solve,
$$-\partial_\mu \partial^\mu\epsilon(x)=\underbrace{\partial_\mu A^\mu}_{\mathrm{original \, \, potential}}$$
for the appropriate $\epsilon(x)$. When quantizing electromagnetism, one will find the commutation relation,
$$[a^\lambda_p,a^{\lambda' \dagger}_q] = -\eta^{\lambda \lambda'}(2\pi)^3 \delta^{(3)}(p-q)$$
for the creation and annihilation operators. This is disturbing because it means for timelike polarization states with $\lambda = 0$, states will have negative norm, i.e.
$$\langle p,0 | q, 0 \rangle = -(2\pi)^3\delta^{(3)}(p-q) < 0$$
To resolve the issue, we demand that physical states $|\Psi \rangle$ satisfy an adaptation of the Lorenz gauge condition due to Gupta and Bleuler, namely,
$$\partial^\mu A^{+}_{\mu} |\Psi\rangle = 0$$
where $A^+$ is the decomposed field, containing only the expansion with the $a$ term, rather than $a^\dagger$ term.