Why do these "equal" logarithms give different answers
The equations "$2\log x = 5$" and "$\log x^2=5$" are not equivalent.
The reason is that the first equation implies that $x>0$ while the second does not.
The correct way to move from the first to the second is to conjoin the condition $x>0$. So instead, one can say that "$2\log x = 5$" and "$\log x^2 = 5 \textrm{ where }x>0$" are equivalent.