It is easy to show that Maxwell's equations are invariant under the following transformation of the four-potential $A^{\mu}$:
$$A^{\mu} \rightarrow A'^{\mu} = A^{\mu} + \partial^{\mu} \chi$$
for some scalar field $\chi$. The idea of gauge fixing is that we can choose different values of $\chi$.
In the Lorenz gauge we fix the gauge such that
$$\partial_{\mu} A'^{\mu} = 0$$
is satisfied. The way I understand it, the only freedom we have is to change the scalar field $\chi$ however we like in order to achieve the $\partial_{\mu} A'^{\mu} = 0$ condition. So it seems to me that we would have to transform $A^{\mu}$ to $A'^{\mu}$, such that
$$\partial_{\mu} A'^{\mu} = 0$$ $$\partial_{\mu} (A^{\mu} + \partial^{\mu}\chi) = 0$$ $$\partial_{\mu}\partial^{\mu}\chi = -\partial_{\mu} A^{\mu}$$
Therefore, according to my reasoning, we have to choose a scalar field $\chi$ which satisfies $\partial_{\mu}\partial^{\mu}\chi = -\partial_{\mu} A^{\mu}$, and then we work with $A'^{\mu} = A^{\mu} + \partial^{\mu} \chi$.
However, I'm wrong. All sources I've checked (including https://en.wikipedia.org/wiki/Lorenz_gauge_condition ) claim that we have to choose $\chi$ such that
$$\partial_{\mu}\partial^{\mu}\chi = 0.$$
The only way I can make sense of this (and to try and understand where I have gone wrong) is that the Lorenz gauge is a gauge of the type
$$A^{\mu} \rightarrow A'^{\mu} = A^{\mu} + \partial^{\mu} \chi$$
where we impose both
$$\partial_{\mu} A'^{\mu} = 0$$
and
$$\partial_{\mu} A^{\mu} = 0$$
such that $\partial_{\mu} A'^{\mu} = \partial_{\mu} (A^{\mu} + \partial^{\mu}\chi) = 0$ implies $\partial_{\mu}\partial^{\mu}\chi = 0$. If this is the correct interpretation of the reasoning behind the Lorenz gauge, then I do not understand it. How can we impose both $\partial_{\mu} A'^{\mu} = 0$ and $\partial_{\mu} A^{\mu} = 0$?
What am I getting wrong with my reasoning? Am I misunderstanding the idea of gauge fixing in the first place?