Question: I tried getting the answers in similar questions, everyone says that it's not necessary, but if $e$ is the identity element for any binary operation $\*$, which is not associative and commutative, how can

$$a\*e=a=e\*a$$

when it is not commutative, i.e. $a\*b \ne b\*a$?

Even if we get a value by solving $a\*e=a$. Will we get the same value by solving
$e\*a=a$ ?
Please provide an example.

Answer: 
Asserting that the operation $\*$ is not commutative means that *there are* elements $a$ and $b$ such that $a\*b\neq b\*a$. It does *not* mean that $a\*b\neq b\*a$ for *any* two distinct elements $a$ and $b$. Therefore, an operation may well not be commutative and, even so, to have an identity element. There is no contradiction here.

For an example of a non-commutative and non-associative algebraic structure with an identity element, take, for instance, the [octonions](https://en.wikipedia.org/wiki/Octonion).
It is possible. $\*$ not being commutative means that $a\*b\neq b\*a$ for some $a,b$, not for all of them. So you may have $a\*e=e\*a=a$ without contradicting that $\*$ is not commutative.