Let us assume $a$ is an integer which is rational which implies $a=p/q$ (where $p$ and $q$ are integers and $q$ not equal to $0$). If $p$ and $q$ are not coprime, let us simplify the fraction so this it is (I don't know how to talk like mathematicians).
Which implies, $$a=b/c$$ (where $b$ and $c$ are coprime integers). Squaring on both sides, \begin{align} a^2&=b^2/c^2\\ a^2c^2&=b^2 \end{align} So $a^2$ is a factor of $b^2$, and also of $b$, due to the uniqueness of the fundamental theorem of arithmetic. So, \begin{align} b &=a^{2}d \tag{where $d$ is an integer}\\ b^2 &= a^{4}d^{2} \end{align} But $b^2=a^2c^2$ So, \begin{align} a^2c^2 &= a^4d^2\\ c^2 &= a^2d^2 \end{align}
So, $a^2$ is a factor of $c^2$ and $c$ due to the fundamental theorem of arithmetic. So $b$ and $c$ have $a^2$ as a common factor. But this contradicts the fact that $b$ and $c$ are coprime. This is because we have taken $a$ as a rational integer, so $a$ cannot be a rational integer.
What's wrong here (genuinely asking)?
The problem in the proof is that $a^2|b^2\nRightarrow a^2|b$. For instance, take $a=2$ and $b=6$. Clearly, $4|36$ but $4\nmid 6$.