Is the axiom of choice needed to show that $a^2=a$?
For [infinite] every well-ordered set $A$ it holds that $A^2\sim A$. Furthermore if $B\subseteq A$ and $A$ can be well-ordered then $B$ can be well-ordered as well, and therefore this property is true for $B$ as well (if it is infinite).
However it is possible that for a non well-ordered set it might not be true anymore, in fact we can easily generate such set from every non well-orderable set. If $A$ is a non well-ordered set and $\aleph(A)$ is an ordinal such that $\aleph(A)\nleq A$ (e.g. the Hartogs number of $A$) then $A+\aleph(A)$ has the property: $$\big(A+\aleph(A)\big)^2>A+\aleph(A)$$
One should remark that it is not true for all non well-ordered sets. Even if $\mathbb R$ cannot be well-ordered it still holds that $\mathbb R^2\sim\mathbb R$.
Some proofs:
To see the proof that $A^2\sim A$ implies choice, see my answer: For every infinite $S$, $|S|=|S\times S|$ implies the Axiom of choice.
To see that for well-ordered sets it holds, see my answer: About a paper of Zermelo.
Let me add a bit of history, and refer to the Jech citation. Zermelo formulated the axiom of choice and proved (without it) that every [infinite] well-orderable set has this property in $1904$. The proof appears in the second link above. When one proves that the axiom of choice is equivalent to the fact that every set can be well-ordered, one immediately sees that the axiom of choice implies that every infinite set is bijectible with its square.
On the other hand, Tarski proved in $1923$ that the opposite holds, in particular the proof relies on an interesting lemma which abuses the example I gave for a set without this squaring property. The details appear in the first answer I have linked.
Interestingly enough, in the early $1970$'s two proofs were announced that $A+A\sim A$ does not imply the axiom of choice. I only know that one was published, it was in the Ph.D. dissertation of Sageev, and my advisor told me that he (an undergrad at the time) remembers Sageev sitting on the bench and working on this proof, and that it took him a long time to finish it. (Every footnote referring to this model suggests that the proof is very hard.)