As pointed out in the comments, the sets are not necessarily equal. Consider the following counterexample :
For even $n$, define $A_n = \{0\}$ and for odd $n$, define $A_n = \{1\}$.
That is, $A_1 = A_3 = A_5 = \cdots = \{1\}$ and $A_2 = A_4 = A_6 = \cdots = \{0\}$.
Let us look at the set $X$ first.
Note that for any given $n \in \mathbb{N}$, the set $\displaystyle\bigcap_{j=n}^\infty A_j$ is empty. This can be easily observed if you notice that $A_n \cap A_{n+1} = \varnothing$. (Why?)
Thus, $X = \displaystyle\bigcup_{n=1}^\infty\varnothing = \varnothing$.
Now, let us look at $Y$.
Note that for any given $n \in \mathbb{N}$, the set $\displaystyle\bigcup_{j=n}^\infty A_j$ equals $\{0, 1\}$.
This is also easy to prove. Note that $A_j \subset \{0, 1\}$ for each $j \ge n$ and hence, $\displaystyle\bigcup_{j=n}^\infty A_j \subset \{0, 1\}$.
To see that the equality follows, note that $A_n \cup A_{n+1} = \{0, 1\}$. (Why?)
Thus, we get that $X \neq Y$.
The next natural question to ask would be whether $X \subset Y$ is true in general?
To see this, one could first try to observe what sort of elements are there in $X$.
Observe that there is a big union outside. Thus, if $x \in X$, then $x \in \displaystyle\bigcap_{j=n_0}^\infty A_j$ for some $n_0 \in \mathbb{N}$.
This then gives us that $x \in A_j$ for every $j \ge n_0$.
Thus, in a more intuitive phrasing: $x$ must belong to every set after a point.
Let us now see if this is enough for $x$ to belong to $Y$ as well.
Note that there is a big intersection on the outside in the definition of $Y$. Thus, for $x$ to belong to $Y$, $x$ must belong to $\displaystyle\bigcup_{j=n}^\infty A_j$ for every $n \in \mathbb{N}$. Does our given $x$ have this property?
Well, yes, it does! Given any $n \in \mathbb{N}$, know that $x$ belongs to $A_{\max\{n, n_0\}}$. (How?)
Thus, $x$ will belong to $\displaystyle\bigcup_{j=n}^\infty A_j$, no matter the $n$. (How?)
In turn, this gives us that $x \in \displaystyle\bigcap_{n=1}^\infty\bigcup_{j=n}^\infty A_j = Y.$
So, what we have shown is that if $x \in X$, then $x \in Y$. This is precisely what it means for $X \subset Y$ and thus, we are done.
Some more intuition: If you try to characterise the elements that belong to $Y$, you'll observe that $y \in Y$ iff $y$ belongs to infinitely many $A_i$s.
However, as we saw, the condition that an element belongs to $X$ was stricter, it required that $x$ must belong to all $A_i$s after a point. That is, $x$ must belong to all but finitely many $A_i$s.
This goes well with the sort of counterexample that we saw, to begin with.