Here is my attempt at answering the above question. (I feel that there are gaps in my knowledge in this topic and don't have a sound understanding of what a covering actually is but here goes!)
As f is surjective, there are $x_1, x_2∈ X$ s.t $f(x_1)=y_1, f(x_2)=y_2$. And f is continuous if for every open $v⊆Y, f^{-1}(v)$ is open in X.
If X is compact, then every open covering $U=(u_i)_{i∈I}$ has a finite subcovering.
Therefore, $f^{-1}(y_1)=x_1$ which is also an open covering. Thus Y is compact.
It is not true that $f^{-1}(y_1)=x_1$. It happens that $f^{-1}(y_1)$ is a set and, in genral, it has more than one element.
If $(U_\lambda)_{\lambda\in\Lambda}$ is an open cover if $Y$, then $\bigl(f^{-1}(U_\lambda)\bigr)_{\lambda\in\Lambda}$ is an open cover of $X$. Therefore, there's a finite subset $F$ of $\Lambda$ such that $\bigl(f^{-1}(U_\lambda)\bigr)_{\lambda\in F}$ is an open cover of $X$. And, since $f$ is surjective, you can deduce from this that $(U_\lambda)_{\lambda\in F}$ is an open cover of $Y$.