Here is a counterexample. Let $S = \{a, 0\}$ with $s^2 = 0$ and $a0 = 0 = 00 =
0a$. Then $aS$ contains the idempotent $0$ and for every $x \in S$, the
condition $a=axa$ implies that $x=xax$, since the premise is never fulfilled.
However $a^2S = \{0\}$ and thus $a \notin a^2S$.
But in fact, you did not reproduce the exercise correctly. The original statement was the following:
The following conditions are equivalent:
- For all $a \in S$, the set $aS$ contains an idempotent and for all $a, x \in S$, the condition $axa = a$ implies $x = xax$.
- For all $a \in S$, $a \in a^2S$ and for all $a, x \in S$, the condition $a = a^2x$ implies $x = x^2a$.
You asked for a proof that (1) implies (2). Here is one:
Let $a \in S$. Then $aS$ contains an idempotent, say $e = ax$. Thus $e = e(ax)e$, whence $ea = (ea)x(ea)$ and $x = x(ea)x$ by the second part of (1). It follows $x = xeax = xee = xe$. Therefore $x = xax$ and $a = axa$.
Let now $y \in S$ be such that $a^2y$ is idempotent. By the previous argument, $y = ya^2y$ and thus $ay = aya^2y = (ay)a(ay)$, whence $a = a(ay)a = a^2(ya)$. Thus $a \in a^2S$.
Similarly, $ya = (ya)a(ya)$, whence $a = a(ya)a$ and $a \in Sa^2$. It follows in particular that $a\ \mathcal{H}\ a^2$. Thus by Green's lemma, the $\mathcal{H}$-class of each element of $S$ is a group.
Suppose now that $a = a^2x$ for some $x \in S$. Let $e$ be the idempotent of the $\mathcal{H}$-class $G$ of $a$ and let $f$ be the idempotent of the $\mathcal{H}$-class $H$ of $x$. Let $\bar a$ be the inverse of $a$ in $G$. Then $e = \bar aa = \bar a(a^2x) = ax$ and thus $axa = a$ and $xax = x = xe$. Thus $e \ \mathcal{L}\ x \ \mathcal{L}\ f$ and thus $ef = e$ and $fe = f$. By Green's lemma, the map $u \to fu$ defines a bijection from $G$ onto $H$ and thus there exists $b \in G$ such that $x = fb$. Therefore, since $a = ae$, we get $a = a^2x = a^2fb = a(ae)fb = aaeb = aab$ and thus $b = \bar a$. Consequently, since $xf = x$, we get $x^2a = xf\bar aa = x\bar aa = xe = x$ .