$\newcommand{\X}{\mathcal X}\newcommand{\B}{\mathcal B}\newcommand{\CC}{\mathcal C}\newcommand{\F}{\mathcal F}\newcommand{\De}{\Delta}\newcommand{\de}{\delta}
\newcommand{\si}{\sigma}$Yes, this is true, even if you only assume that $X$ is at most countable. Moreover, let us actually show that the conjectured necessary condition for $E\in\B(Z)$ is also sufficient.
Sufficiency: Take any $x\in X$ and let
\begin{equation*}
\B_x:=\{B\in\B(Y)\colon \{x\}\times B\in\B(Z)\}.
\end{equation*}
Since the topology on $X$ is discrete, the set $\{x\}$ is open in $X$. So, by the definitions of the product topology and $\B(Z)$, the topology (say $T_Y$) over $Y$ is contained in $\B_x$. Also, it is easy to see that $\B_x$ is a $\si$-algebra over $Y$. It follows that $\B_x=\B(Y)$, for each $x\in X$.
Therefore and because $X$ is at most countable, if $E=\bigcup_{x\in A}(\{x\}\times F_x)$ for some $A\subseteq X$ and a family $(F_x)_{x\in A}\in\B(Y)^A$, then $E\in\B(Z)$.
Necessity: For any $x\in X$ and any $E\subseteq X\times Y$, let
\begin{equation*}
E_x:=\{y\in Y\colon(x,y)\in E\},
\end{equation*}
so that
\begin{equation*}
E=\bigcup_{x\in X}(\{x\}\times E_x).
\end{equation*}
We want to show that $E_x\in\B(Y)$ if $E\in\B(Z)$.
Let
\begin{equation*}
\CC_x:=\{E\in\B(Z)\colon E_x\in\B(Y)\}.
\end{equation*}
Suppose first that $E$ is open in $Z$. Take any $y\in E_x$, so that $(x,y)\in E$. Then there exist open subsets $V_x$ of $X$ and $V_y$ of $Y$ such that $(x,y)\in V_x\times V_y\subseteq E$, so that $\{x\}\times V_y\subseteq E$ and hence $V_y\subseteq E_x$. So, $E_x$ is open in $Y$, for each $E$ in the topology (say $T_Z$) over $Z$. So, $T_Z\subseteq\CC_x$. Also, it is easy to see that $\CC_x$ is a $\si$-algebra over $Z$. So, $\CC_x=\B(Z)$. So, $E_x\in\B(Y)$ for all $x\in X$ and $E\in\B(Z)$.
We conclude that $E\in\B(Z)$ if and only if
$E=\bigcup_{x\in A}(\{x\}\times F_x)$ for some $A\subseteq X$ and a family $(F_x)_{x\in A}\in\B(Y)^A$. $\quad\Box$
This description of $\B(Z)$ can be simplified as follows, with almost the same reasoning (cf. the comment by Dieter Kadelka):
$E\in\B(Z)$ if and only if
$E=\bigcup_{x\in X}(\{x\}\times F_x)$ for a family $(F_x)_{x\in A}\in\B(Y)^X$.