[proofplan]
We reduce to the case $X \geq 0$ and verify that $\mathbb{E}[X \mid \mathcal{G}]$ satisfies the defining conditions for $\mathbb{E}[X \mid \sigma(\mathcal{G}, \mathcal{H})]$. The [integral](/page/Integral)-matching condition is first verified on the $\pi$-system $\{A \cap B : A \in \mathcal{G}, B \in \mathcal{H}\}$, using the independence of $\sigma(X, \mathcal{G})$ from $\mathcal{H}$. The [Dynkin $\pi$-System Lemma](/theorems/505) then extends the identity to all of $\sigma(\mathcal{G}, \mathcal{H})$.
[/proofplan]
[step:Reduce to the case $X \geq 0$]
Write $X = X^+ - X^-$. If the result holds for non-negative integrable random variables, then by linearity of conditional expectation ([Basic Properties of Conditional Expectation](/theorems/1148), part (v)):
\begin{align*}
\mathbb{E}[X \mid \sigma(\mathcal{G}, \mathcal{H})] &= \mathbb{E}[X^+ \mid \sigma(\mathcal{G}, \mathcal{H})] - \mathbb{E}[X^- \mid \sigma(\mathcal{G}, \mathcal{H})] \\
&= \mathbb{E}[X^+ \mid \mathcal{G}] - \mathbb{E}[X^- \mid \mathcal{G}] = \mathbb{E}[X \mid \mathcal{G}].
\end{align*}
We therefore assume $X \geq 0$ for the remainder.
[/step]
[step:Verify the integral-matching condition on the $\pi$-system $\{A \cap B : A \in \mathcal{G}, B \in \mathcal{H}\}$]
Let $A \in \mathcal{G}$ and $B \in \mathcal{H}$. We must show $\mathbb{E}[\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_{A \cap B}] = \mathbb{E}[X \mathbb{1}_{A \cap B}]$.
For the right side, the product $X \mathbb{1}_A$ is $\sigma(X, \mathcal{G})$-measurable (since $X$ is $\sigma(X)$-measurable and $\mathbb{1}_A$ is $\mathcal{G}$-measurable), and $\mathbb{1}_B$ is $\mathcal{H}$-measurable. Since $\sigma(X, \mathcal{G})$ is independent of $\mathcal{H}$ by hypothesis:
\begin{align*}
\mathbb{E}[X \mathbb{1}_A \mathbb{1}_B] = \mathbb{E}[X \mathbb{1}_A] \, \mathbb{P}(B).
\end{align*}
The integral-matching condition for $\mathbb{E}[X \mid \mathcal{G}]$ (with test [set](/page/Set) $A \in \mathcal{G}$) gives $\mathbb{E}[X \mathbb{1}_A] = \mathbb{E}[\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_A]$.
For the left side, $\mathbb{E}[X \mid \mathcal{G}]$ is $\mathcal{G}$-measurable, hence $\sigma(X, \mathcal{G})$-measurable (since $\mathcal{G} \subset \sigma(X, \mathcal{G})$). Therefore $\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_A$ is $\sigma(X, \mathcal{G})$-measurable, and the independence hypothesis gives:
\begin{align*}
\mathbb{E}\bigl[\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_A \, \mathbb{1}_B\bigr] = \mathbb{E}\bigl[\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_A\bigr] \, \mathbb{P}(B) = \mathbb{E}[X \mathbb{1}_A] \, \mathbb{P}(B).
\end{align*}
Combining both computations:
\begin{align*}
\mathbb{E}\bigl[\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_{A \cap B}\bigr] = \mathbb{E}[X \mathbb{1}_A] \, \mathbb{P}(B) = \mathbb{E}[X \mathbb{1}_{A \cap B}].
\end{align*}
[guided]
The independence hypothesis $\sigma(X, \mathcal{G}) \perp\!\!\!\perp \mathcal{H}$ is used twice, and it is important to understand exactly what it buys us. Independence of two $\sigma$-algebras $\mathcal{A}$ and $\mathcal{B}$ means $\mathbb{E}[UV] = \mathbb{E}[U] \, \mathbb{E}[V]$ whenever $U$ is bounded $\mathcal{A}$-measurable and $V$ is bounded $\mathcal{B}$-measurable.
First application: $U = X \mathbb{1}_A$ is $\sigma(X, \mathcal{G})$-measurable and $V = \mathbb{1}_B$ is $\mathcal{H}$-measurable, giving $\mathbb{E}[X \mathbb{1}_A \mathbb{1}_B] = \mathbb{E}[X \mathbb{1}_A] \cdot \mathbb{P}(B)$. (For unbounded $X$, this extends from bounded $X$ by the [Monotone Convergence Theorem](/theorems/509) using $X \geq 0$.)
Second application: $U = \mathbb{E}[X \mid \mathcal{G}] \cdot \mathbb{1}_A$ is $\sigma(X, \mathcal{G})$-measurable (here we use $\mathcal{G} \subset \sigma(X, \mathcal{G})$) and $V = \mathbb{1}_B$ is $\mathcal{H}$-measurable, giving the factorisation of the left side.
The two factorisations produce the same value $\mathbb{E}[X \mathbb{1}_A] \cdot \mathbb{P}(B)$, establishing the integral-matching condition on rectangles $A \cap B$.
[/guided]
[/step]
[step:Extend to all of $\sigma(\mathcal{G}, \mathcal{H})$ by the $\pi$-$\lambda$ theorem]
Define two finite measures on $\sigma(\mathcal{G}, \mathcal{H})$:
\begin{align*}
\mu(F) &= \mathbb{E}\bigl[\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_F\bigr], \\
\nu(F) &= \mathbb{E}\bigl[\mathbb{E}[X \mid \sigma(\mathcal{G}, \mathcal{H})] \, \mathbb{1}_F\bigr].
\end{align*}
Note that $\nu(F) = \mathbb{E}[X \mathbb{1}_F]$ by the integral-matching condition for $\mathbb{E}[X \mid \sigma(\mathcal{G}, \mathcal{H})]$. The previous step established $\mu = \nu$ on the collection $\mathcal{P} = \{A \cap B : A \in \mathcal{G}, B \in \mathcal{H}\}$.
The collection $\mathcal{P}$ is a $\pi$-system (closed under finite intersections: $(A_1 \cap B_1) \cap (A_2 \cap B_2) = (A_1 \cap A_2) \cap (B_1 \cap B_2)$ with $A_1 \cap A_2 \in \mathcal{G}$ and $B_1 \cap B_2 \in \mathcal{H}$), and $\sigma(\mathcal{P}) = \sigma(\mathcal{G}, \mathcal{H})$. Since $\mu(\Omega) = \mathbb{E}[\mathbb{E}[X \mid \mathcal{G}]] = \mathbb{E}[X] = \nu(\Omega) < \infty$, the [Dynkin $\pi$-System Lemma](/theorems/505) gives $\mu = \nu$ on all of $\sigma(\mathcal{G}, \mathcal{H})$.
Since $\mathbb{E}[X \mid \mathcal{G}]$ is $\mathcal{G}$-measurable (hence $\sigma(\mathcal{G}, \mathcal{H})$-measurable) and satisfies $\mathbb{E}[\mathbb{E}[X \mid \mathcal{G}] \, \mathbb{1}_F] = \mathbb{E}[X \mathbb{1}_F]$ for all $F \in \sigma(\mathcal{G}, \mathcal{H})$, the uniqueness of conditional expectation gives $\mathbb{E}[X \mid \sigma(\mathcal{G}, \mathcal{H})] = \mathbb{E}[X \mid \mathcal{G}]$ a.s.
[guided]
The $\pi$-$\lambda$ argument is a standard tool for extending identities between measures from a generating $\pi$-system to the full $\sigma$-algebra. The [Dynkin $\pi$-System Lemma](/theorems/505) states: if two finite measures agree on a $\pi$-system $\mathcal{P}$ and have the same total mass, then they agree on $\sigma(\mathcal{P})$.
We verify the hypotheses: $\mathcal{P} = \{A \cap B : A \in \mathcal{G}, B \in \mathcal{H}\}$ is a $\pi$-system because the intersection of two rectangles is a rectangle (the intersection of $\mathcal{G}$-sets is a $\mathcal{G}$-set, and likewise for $\mathcal{H}$-sets). The $\sigma$-algebra generated by $\mathcal{P}$ is $\sigma(\mathcal{G}, \mathcal{H})$ because $\mathcal{P}$ contains all sets of the form $A \cap \Omega = A$ for $A \in \mathcal{G}$ and $\Omega \cap B = B$ for $B \in \mathcal{H}$. Finally, $\mu(\Omega) = \mathbb{E}[X] = \nu(\Omega) < \infty$ since $X \in L^1$.
This is a recurring technique in probability: to prove an identity involving conditional expectations, verify it on a $\pi$-system generating the relevant $\sigma$-algebra, then invoke the uniqueness of extension.
[/guided]
[/step]