Let $y\in X$ be arbitrary. Consider the sequence $y_n = f^ {n}(y) = \underbrace{(f\circ \ldots \circ f)}_{n}(y)$ that consists of applying the function $n\geq 1$ times to the point $y$. Since $y_n \in f(X)$ for every $n\geq 1$, and $f(X)$ is compact (because $f$ is continuous), $(y_n)$ has a convergent subsequence $y_{n_k} \to f(x_0)$, for some $x_0 \in X$. Observe that for $k\geq 1$,
$$
\varrho(f^{n_k - 1}(y),x_0) \leq \varrho(f^{n_k}(y),f(x_0)) \underbrace{\longrightarrow}_{k\to \infty} 0.
$$
Therefore, $x_0$ is the limit of the sequence $(y_{n_k-1})_{k\in \mathbb{N}}$ (which is in $fX$), and $x_0 \in f(X)$. We write $x_0 = f(x_1)$, for $x_1\in X$. Using the same argument, we can prove $x_1$ is the limit of the sequence $(y_{n_k-2})_{k\in \mathbb{N}}$, which means $x_1\in f(X)$, and we write $x_1 = f(x_2)$. Proceeding like this, we get a sequence $(x_n)_{n\geq 0}$ in $f(X)$ such that $f(x_n)=x_{n-1}$ for all $n\geq 1$ and such that $y_{n_k-n+1} \to x_n$ (for large $k$). Then, for $k\geq 1$,
$$
\varrho(y,x_{n_k-1}) \leq \varrho(fy,x_{n_k-2}) \leq \ldots \leq \varrho(f^{n_k}(y),x_0).
$$
We then conclude that $y=\lim_{k\to \infty}x_{n_k - 1}$, which means $y\in f(X)$.