The statement of the Theorem given as a reference is false. As such, it is just a distraction with respect to the Question, which David C. Ullrich has answered by providing a nice example.
I just will focus on the theorem to help clarify beyond what has already been discussed in the comments.
The hypothesis is that the bounded function $f:X \times Y \to \mathbb{R}$ is Riemann integrable on the bounded interval (rectangle) $X \times Y \subset \mathbb{R}^{n+m}.$ What is a true statement is that
$$\tag{1}\int_{X \times Y} f = \int_X \left(\underline{\int}_Y f(x,y) \, dy\right) dx = \int_X \underline{J}(x) \, dx \\ = \int_X \left(\overline{\int}_Y f(x,y) \, dy\right) \, dx = \int_X \overline{J}(x)\, dx, $$
where for fixed $x\in X$ the lower and upper Darboux integrals appearing above must exist (since $f$ is bounded) and as a conclusion are themselves Riemann integrable over $X$ and satisfy (1).
We also have a similar statement as (1) with the order of the integration reversed, but we don't need to discuss that to proceed.
Proof of (1)
Let $P = P_X \times P_Y$ be partition of $X \times Y$ where $P_X$ and $P_Y$ are partions of $X$ and $Y$ into subintervals in $\mathbb{R}^m$ and $\mathbb{R}^n$, respectively. On any subinterval $R_X \times R_Y$ of $P$ we have $m_{R_X \times R_Y}(f) = \inf_{R_X \times R_Y} f(x,y) \leqslant f(x,y)$ and $m_{R_X \times R_Y}(f) \leqslant \inf_{R_Y} f(x,y) = m_{R_Y}(f)$, where we take $x$ as fixed in the second inequality.
Hence,
$$\sum_{R_Y} m_{R_X \times R_Y}(f) \text{vol }(R_Y) \\ \leqslant \sum_{R_Y} m_{R_Y}(f) \text{vol }(R_Y) = L(P_Y, f(x,\cdot)) \leqslant \underline{\int}_Y f(x,y) \, dy = \underline{J}(x)$$
Taking the infimum over $x \in R_X$, multiplying by $\text{vol }(R_X)$, and summing we get for lower Darboux sums
$$L(P,f) = \sum_{R_X, R_Y} m_{R_X \times R_Y}(f) \text{vol }(R_Y)\text{vol }(R_X) \leqslant \sum_{R_X} \inf_{R_X} \underline{J}(x) \text{vol }(R_X) = L(P_X, \underline{J}) $$
Similarly we can show for upper Darboux sums that $U(P,f) \geqslant U(P_X, \overline{J}),$ and it follows that
$$L(P,f) \leqslant L(P_X, \underline{J}) \leqslant U(P_X,\underline{J}) \leqslant U(P_X,\overline{J}) \leqslant U(P,f), \\ L(P,f) \leqslant L(P_X, \underline{J}) \leqslant L(P_X,\overline{J}) \leqslant U(P_X,\overline{J}) \leqslant U(P,f). $$
Since $f$ is Riemann integrable, for any $\epsilon > 0$ there is a partition $P$ such that
$$U(P,f) - L(P,f) < \epsilon, \,\, U(P_X,\underline{J}) - L(P_X,\underline{J}) < \epsilon, \, \, U(P_X,\overline{J}) - L(P_X,\overline{J}) < \epsilon,$$
and it follows that $\underline{J}$ and $\overline{J}$ are integrable over $X$ and (1) holds.
Correction of the Theorem (Zorich)
Since $\int_X \overline{J}(x) \, dx = \int_X \underline{J}(x) \, dx $ and $\overline{J}(x) \geqslant \underline{J}(x)$, it follows that $\overline{J}(x) = \underline{J}(x)$ almost everywhere, and the Riemann integral
$$\int_Y f(x,y) \, dy$$
exists except perhaps for $x$ in a set of measure zero where $\underline{J}(x) < \overline{J}(x)$ with strict inequality.
As pointed out by David C. Ulrich, that does not mean that a value may be assigned arbitrarily to the "symbol" $\int_Y f(x,y) \, dy$ and the Theorem holds. What Zorich should have stated is let the function $F:X \to \mathbb{R}$ be defined as
$$F(x) = \int_Y f(x,y) \, dy$$
when that integral exists, and let it be defined as any value in the interval
$[\underline{J}(x), \overline{J}(x)]$ when $\underline{J}(x) < \overline{J}(x)$ and the integral does not exist. Then instead of (1) the correct statement is
$$\tag{2} \int_{X \times Y} f = \int_X F(x) \, dx,$$
with something similar when the order of integration is reversed.