Fix $x$. Then the "inclusion" $g_x \colon Y \to X \times Y, y \mapsto (x,y)$ is continuous. Indeed, an open set in $X \times Y$ is of the form $\bigcup_i (U_i \times V_i)$ and $g_x^{-1}(\bigcup_i (U_i \times V_i)) = \bigcup_j V_j$ is open, where $J := \{i \in I \mid x \in U_i\}$.
Let $W$ be an open subset of $Z$. Then $f(x)^{-1}(W)=g_x^{-1}(f^{-1}(W))$ is open because $g_x$ and $f$ are continuous.
We usually speak of joint VS separate continuity. It is a topic that still has some active research. But there are not so difficult examples of separately continuous functions that are not jointly continuous. A classical is the following (see also this answer):
$$f \colon \mathbb{R}^2 \to \mathbb{R}, \quad f(x,y) = \begin{cases}\qquad 0 &, x = y = 0\\ \dfrac{xy}{x^2+y^2} &, x^2+y^2 > 0\end{cases}$$
You can easily see that $f(x=0)$ and $f(y=0)$ are continuous because they are constantly $0$. And for values other than $0$, everything is fine. But $f$ is not jointly continuous. Indeed, when $r:=x^2+y^2>0$, you can write $x=r \cos(\phi)$, $y=r \sin(\phi)$ and $f(x,y) = \cos(\phi)\sin(\phi)$. In particular, $f$ is constant along rays starting from $0$, so that there is no "total" limit of $f$ for $(x,y) \to 0$.