$\mathbb E\left(X\mid Y\right)$ is by definition a random variable satisfying:
It is measurable with respect to the $\sigma$-algebra generated by rv $Y$.
$\int_{A}X\left(\omega\right)\rm d P\left(\omega\right)=\int_{A}\mathbb E\left(X\mid Y\right)\left(\omega\right)\rm d P\left(\omega\right)$
for each set $A$ in $\sigma$-algebra generated by rv $Y$.
The first condition comes to the same as demanding that it can be written as $f\left(Y\right)$ for a Borel-measurable function $f:\mathbb{R}\rightarrow\mathbb{R}$.
In special case $\mathbb E\left(X\mid X\right)$ function $f=1_{\mathbb{R}}$
can do the job and $\mathbb E\left(X\mid X\right)=X$.
$\mathbb E\left(X\mid Y\right)$ is by definition a random variable satisfying:
It is measurable with respect to the $\sigma$-algebra generated by rv $Y$.
$\int_{A}X\left(\omega\right)\rm d P\left(\omega\right)=\int_{A}\mathbb E\left(X\mid Y\right)\left(\omega\right)\rm d P\left(\omega\right)$ for each set $A$ in $\sigma$-algebra generated by rv $Y$.
The first condition comes to the same as demanding that it can be written as $f\left(Y\right)$ for a Borel-measurable function $f:\mathbb{R}\rightarrow\mathbb{R}$.
In special case $\mathbb E\left(X\mid X\right)$ function $f=1_{\mathbb{R}}$ can do the job and $\mathbb E\left(X\mid X\right)=X$.