[guided]We want to prove that $g$ is the density of $X$, so we must show that every Borel probability of $X$ is obtained by integrating $g$ over the corresponding Borel set. Fix an arbitrary Borel set $A\in\mathcal B(\mathbb R^m)$. The event $\{X\in A\}$ is the same as the event $\{(X,Y)\in A\times\mathbb R^n\}$, because no restriction is imposed on the $Y$-coordinate. Thus
\begin{align*}
\mathbb P(X\in A)=\mathbb P((X,Y)\in A\times\mathbb R^n).
\end{align*}
Since $(X,Y)$ has joint density $f_{X,Y}$ with respect to $\mathcal L^{m+n}$, the definition of density gives
\begin{align*}
\mathbb P((X,Y)\in A\times\mathbb R^n)=\int_{A\times\mathbb R^n} f_{X,Y}(x,y)\,d\mathcal L^{m+n}(x,y).
\end{align*}
To separate the $x$-variable from the $y$-variable, define
\begin{align*}
H_A:\mathbb R^m\times\mathbb R^n\to[0,\infty),\qquad H_A(x,y)=\mathbb 1_A(x)f_{X,Y}(x,y).
\end{align*}
This function is measurable because $\mathbb 1_A$ is Borel-measurable on $\mathbb R^m$ and $f_{X,Y}$ is product-measurable on $\mathbb R^m\times\mathbb R^n$. It is non-negative because both factors are non-negative. These are precisely the hypotheses needed to apply Tonelli's theorem for non-negative measurable functions. Using the identification $\mathcal L^{m+n}=\mathcal L^m\otimes\mathcal L^n$, Tonelli's theorem gives
\begin{align*}
\int_{A\times\mathbb R^n} f_{X,Y}(x,y)\,d\mathcal L^{m+n}(x,y)=\int_{\mathbb R^m}\int_{\mathbb R^n}\mathbb 1_A(x)f_{X,Y}(x,y)\,d\mathcal L^n(y)\,d\mathcal L^m(x).
\end{align*}
For each fixed $x\in\mathbb R^m$, the quantity $\mathbb 1_A(x)$ is constant as a function of $y$. Therefore it factors out of the inner integral:
\begin{align*}
\int_{\mathbb R^n}\mathbb 1_A(x)f_{X,Y}(x,y)\,d\mathcal L^n(y)=\mathbb 1_A(x)\int_{\mathbb R^n}f_{X,Y}(x,y)\,d\mathcal L^n(y).
\end{align*}
By the definition of $g$, this is
\begin{align*}
\int_{\mathbb R^n}\mathbb 1_A(x)f_{X,Y}(x,y)\,d\mathcal L^n(y)=\mathbb 1_A(x)g(x).
\end{align*}
Substituting this into the preceding display gives
\begin{align*}
\mathbb P(X\in A)=\int_{\mathbb R^m}\mathbb 1_A(x)g(x)\,d\mathcal L^m(x).
\end{align*}
Finally, the defining property of the indicator function converts this integral over all of $\mathbb R^m$ into an integral over $A$:
\begin{align*}
\mathbb P(X\in A)=\int_A g(x)\,d\mathcal L^m(x).
\end{align*}
This is exactly the density identity for the random vector $X$.[/guided]