The difference is that (-2)^2 has a parentheses while -2^2 doesn’t. This is a major impact
(-2)^2 = (-2) * (-2) = 4
-2^2 = -(2 * 2) = -4
You can see that the solutions would also be different since for the second one, you would carry over the negative