for each $x,y,z \in X$ we have \[ \inf_x f_1(x,y) + \inf_z f_2(y,z) \le f_1(x,y) + f_2(y,z) \] so the left hand side is a lower bound for $\{f(x,y,z)\mid x,z \in X\}$. As the infimum is the greatest lower bound, we obtain \[ \inf_x f_1(x,y) + \inf_z f_2(y,z) \le \inf_{x,z} \bigl(f_1(x,y) + f_2(y,z) \bigr). \] On the other hand, we have for each $x,y,z \in X$ \[ \inf_{x,z} \bigl(f_1(x,y) + f_2(y,z) \bigr) \le f_1(x,y) + f_2(y,z) \] As this holds (fixing $z$ for the moment) for each $x$ we get \[ \inf_{x,z} \bigl(f_1(x,y) + f_2(y,z) \bigr) \le\inf_x\bigl( f_1(x,y) + f_2(y,z) \bigr) = \inf_x f_1(x,y) + f_2(y,z) \] This holds for each $z$ and therefore \[ \inf_{x,z} \bigl(f_1(x,y) + f_2(y,z) \bigr) \le\inf_z\bigl( \inf_x f_1(x,y) + f_2(y,z) \bigr) = \inf_x f_1(x,y) + \inf_z f_2(y,z). \] So the inequality in question holds always, we don't need coninuity or compactness.
Regarding your second question: Since $X^2$ is compact, $f_1$ is uniformly continuous. Now let $\epsilon > 0$. By uniform continuity there is $\delta > 0$ s. t. |f_1(x',y') - f_1(x,y)| < \epsilon for d(x',x), d(y',y) < \delta. Now let $y,y' \in X$ with d(y',y) < \delta. Since $X$ is compact, infima of continuous functions are attained and therefore there are $x, x' \in X$ with $g(y) = f_1(x,y)$ and $g(y') = f_1(x',y')$. Assume wlog g(y) < g(y'), we have \begin{align*} g(y') &= f_1(x',y')\\\ &= \inf_a f_1(a,y')\\\ &\le f_1(x,y')\\\ &\le f_1(x,y) + \epsilon \quad\text{as d(y,y') < \delta}\\\ &= g(y) + \epsilon\\\ \iff g(y') - g(y) &\le \epsilon \end{align*} So $g$ is (uniformly) continuous.