In the following:
Let G be a group such that a^2=e for every a in G.
it is obvious that here e refers to the unit of the group G.
But if I wrote
Let G be a group such that a^2=x for every a in G.
the identity of x wouldn't be so obvious.
Even worse if an e is already restricted as the Euler number, e.g. if we are talking about groups made of real functions.
Could one give me a short reasoning why e refers to the unit in the first but x does not in the second example?
In the case at hand, we can determine that $e$ (and, in the second example, $x$) must be the identity because it's the square of every element and therefore in particular the square of the identity, which is of course just the identity.
But in general, the reason we understand $e$ (but not $x$) as being the identity is because enough authors have used this notation and we've gotten used to it. If another $e$ is under discussion also, then using $e$ for two different things would be a mistake.