Let consider the reduced residue set:
$$ \{ 1, 2, 3, 4, \ldots, p-1 \} $$
If \((a, p) = 1\), then this is also a reduced residue set:
$$ \{ a, 2a, 3a, 4a, \ldots, (p-1)a \} $$
If \((a^2 ≡ a \bmod p)\), then \(a^2\) can only be congruent to \(a\) in the set above and no other integer:
$$ \begin{align} a^2 &\not \equiv 2a &&\bmod p \\ a^2 &\not \equiv 3a &&\bmod p \\ a^2 &\not \equiv (p-1)a &&\bmod p\end{align}$$
Since \((a,p) = 1\):
$$ \begin{align} a &\not \equiv 2 &&\bmod p \\ a &\not \equiv 3 &&\bmod p \\ a &\not \equiv (p-1) &&\bmod p\end{align}$$
This can only mean that \((a ≡ 0 \bmod p)\) or \((a ≡ 1 \bmod p)\).