Question: Let $X$ be a compact topological space with continuous map $f\colon X\to X$. $Y:=\bigcap\_{n\in\mathbb{N}}f^n(X)\subseteq X$ is closed and hence compact itself. 

Assume $\overline{A}=Y$, i.e. $A$ is be dense in $Y$.

Does this imply $\overline{A}=X$, i.e. that $A$ is dense in $X$?

Answer: 
No it does not. For a counterexample take $Y = [0, 1]$ and $X = [-1, 2]$ as subsets of $\mathbb{R}$ (where $\mathbb{R}$ has the standard topology). Note that $X$ is compact and $Y \subseteq X$ and $Y$ is closed and thus also compact. Then let $A = (0, 1) \subseteq Y \subseteq X$. 

Then we have $\overline{A} = Y$ and certainly $\overline{A} = [0, 1] \neq [-1, 2] = X$.
If $Y$ is a proper subset of $X$, so $X \neq Y$, then $A$ is certainly *not* dense in $X$. The closure cannot both be $Y$ and $X$ at the same time...

"$A$ dense in $Y$" implies $A \subseteq Y$ and so $\overline{A} \subseteq \overline{Y} = Y \neq X$.