Step back and ask how you know whether a Lagrangian, $L=L(Q_i,\dot Q_i),$ is correct. At the classical level the only answer is whether it gives the correct equations of motion as the Euler-Lagrange equations: $$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot Q_i}\right)=
\frac{\partial L}{\partial Q_i}.
$$
Which is unchanged if you replace $L=L_1(Q_i,\dot Q_i)$ with $L=L_2(Q_i,\dot Q_i)=e^\alpha L_1(Q_i,\dot Q_i)$ for some constant $\alpha$. However the Hamiltonian, like the Lagrangian, is a function and when you change the Lagrangian you change the canonical momentum so you change the whole domain of the Hamiltonian so it is a totally different Hamiltonian.
When you select $\alpha=i\pi$ you change the sign of the Hamiltonian as well as changing the domain of the Hamiltonian. But this doesn't change the physics.
But also keep in mind that there is no requirement that the Hamiltonian be an energy, and even if it were there is nothing wrong with a negative energy, you could add a constant to the Lagrangian too without changing the equations of motion but it will shift the Hamiltonian too (by an opposite amount).
So the zero of the Hamiltonian is as arbitrary as the zero of potential energy. Which means don't read too much into it all by itself but if you are going to compare things or combine them then offsets between them can matter.
This can also sensitize you to when someone makes an arbitrary choice at one stage to see if it mattered at a later stage.