If $f$ is irreducible in $\mathbb{Q}[x]$, and $\alpha$ is any root of $f$, then the map $\phi_{\alpha}$ which sends $h(x) \mapsto h(\alpha)$ is an onto homomorphism from $\mathbb{Q}[x]$ to $\mathbb{Q}(\alpha)$. The kernel is $(f)$ and so $\phi_{\alpha}$ is an isomorphism from $\mathbb{Q}[x]/(f)$ to $\mathbb{Q}(\alpha)$.
Apply this to $\alpha = a$ and to $\alpha = a^2$, compose the two isomorphisms, and what you find is an isomorphism from $\mathbb{Q}(a)$ to $\mathbb{Q}(a^2)$ that sends $a$ to $a^2$. But since $\mathbb{Q}(a^2) \subseteq \mathbb{Q}(a)$, and since they are isomorphic, you find $\mathbb{Q}(a^2) = \mathbb{Q}(a)$. Therefore, the isomorphism from $\mathbb{Q}(a)$ to $\mathbb{Q}(a^2)$ that sends $a$ to $a^2$ is actually an automorphism of $\mathbb{Q}(a)$.