Confused when changing from Lebesgue Integral to Riemann Integral

It is not really a matter of changing from Lebesgue integral to Riemann integral, it is a matter of changing measures (sort of a change of variables).

By definition, given $X : \Omega \to \mathbb{R}$ a random variable, $E[X]=\int_{\Omega}X$.

$X$ defines a measure $\widetilde{m}$ in $\mathbb{R}$, called the push-forward, by $\widetilde{m}(A)=P(X^{-1}(A)).$ By definition, this measure is invariant under $X$, and hence \begin{equation} \tag{1} \int_{\mathbb{R}} f d\widetilde{m}= \int_{\Omega}f \circ XdP. \end{equation} The equality follows from the usual arguments (prove for characteristics, simple functions, then use convergence. Recall that $\mathbf{1}_A \circ X=\mathbf{1}_{X^{-1}(A)}$).

Let $h$ be the density of $X$. We then have, by definition of density, that $\widetilde{m}(A)=P(X^{-1}(A))=\int_A h dm$ for any $A \in \mathcal{B}(\mathbb{R})$, where $m$ is the Lebesgue measure. By "change of variables" (which is Theorem $1.29$ in Rudin's RCA for example, but is just another instance of repeating the argument of proving for characteristics, simple functions and using convergence), we have: \begin{equation} \tag{2} \int_{\mathbb{R}} f d\widetilde{m}=\int_{\mathbb{R}}f \cdot h dm. \end{equation} Combining $(1)$ and $(2)$, $$\int_{\mathbb{R}} f \cdot h dm= \int_{\Omega}f \circ X dP. $$ Taking $f=\mathrm{Id}$ yields $$\int_{\mathbb{R}} x h(x)dx= \int_{\Omega} X dP=E[X]. $$ Taking $f=\mathrm{Id}\cdot\mathbf{1}_I$, where $I$ is some interval (for example, $(0,+\infty)$ as in your case), we have $$\int_{I} x h(x)dx= \int_{X^{-1}(I)} X dP, $$ recalling again that $\mathbf{1}_A \circ X=\mathbf{1}_{X^{-1}(A)}$. Since $P(X<0)$ in your case is $0$, this last integral is actually equal to the integral over the whole space, and hence to $E[X]$, which gives your equality.