Infimum is a continuous function, compact set

Following the suggestion of Joe Johnson (I was going using intervals $(a,b)$, but this is simpler) (do you see why Joe's suggestion is enough? The sets $(a,\infty)$ and $(-\infty,a)$ form a subbasis for the topology of $\mathbb{R}$, and for a function to be continuous, it suffices to show that the inverse image of every set in a given subbasis is open).

Let $a\in\mathbb{R}$. What is $g^{-1}(-\infty,a)$? It consists of all $x\in X$ such that $g(x)\lt a$. If $g(x)\lt a$, there exists $y_x$ such that $f(x,y_x)\lt a$. Since $f$ is continuous, $f^{-1}(-\infty,a)$ is open, and $(x,y_x)\in f^{-1}(-\infty,a)$, so there exist open sets $U_x$ and $V_y$ of $X$ and $Y$, respectively, such that $U_x\times V_y\subseteq f^{-1}(-\infty,a)$.

Now, suppose $x'\in U_x$. Then for all $y\in V_y$ (in particular, for $y_x$) you have $f(x',y_x)\in (-\infty,a)$. What does that tell you about $g(x')$? What does that tell you about $g^{-1}(-\infty,a)$?

Now try to do something along those lines with $g^{-1}(a,\infty)$.