This is Russell's paradox in a nutshell. Russell's paradox showed that there cannot be a set of all the sets which do not contain themselves. This version is a "localized" version where we only care about elements from $X$, and it shows that there is always a collection which is not an element of $X$.

If $Y\in X$ ask yourself is $Y\in Y$? If it is, then $Y\notin Y$, by the defining property of $Y$; if $Y\notin Y$ then $Y\in X$ and $Y\notin Y$ so again by the definition of $Y$ we have that $Y\in Y$.

Either way we have a contradiction so it must be that $Y\notin X$.

In set theory like ZFC where $\in$ is well-founded and $\forall x.x\notin x$, we actually have that $Y=X$.