I'm reading Time Series Analysis and Forecasting by Example by Søren Bisgaard and Murat Kulahci and I'm having trouble conceptualizing a particular passage and it's bugging me enough that I can't move on. The passage is discussing the difference between the independence of two variables and their correlation.

My confusion comes in the last paragraph. I'm failing to understand both why those two integrals are equal to E(XY) and why that implies E(XY) = E(X)E(Y). Where did the squared terms on the x's come from? Why are we subtracting the integrals? These are all questions that my puny math-jargon-dumb brain is short circuiting on.
If $f_X$ is the density function of $X$, then the density of $Y=|X|$ is $f_Y(x)=2f_X(x)$ for $x>0$ and $f_Y(x)=0$ for $x<0$. Thus $$\tag1E[Y]=\int_{-\infty}^\infty xf_Y(x)\,\mathrm dx = 2\int_0^\infty xf_X(x)\,\mathrm dx.$$ This intermediate result is not really needed, except that we may be more compfortable with the computation if this $E[Y]$ is finite. In fact, we better pick our $X$ and $f$ so that all relevant integrals in these computations exist. A straightforward explicit example would be to let $X$ be uniformly distributed on $[-1,1]$. What is more important than $(1)$ is the observation that $E[X]=0$ by mere symmetry of $X$: The probability that $a<X<a+\epsilon$ is the same as the probability that $-a-\epsilon<X<-a$, hence everything cancels ; or to see it a different way: We know that $E[cX]=cE[X]$ and as $-X$ has the same distribution as $X$ we conclude $E[X]=E[-X]=-E[X]$, so $E[X]=0$ (if the integral exists). Now notie that $XY$ also has a symmetic distribution: If $a\ge0$ then $a<XY<a+\epsilon\iff \sqrt a<X<\sqrt{a+\epsilon}$ and $-a-\epsilon<XY<a\iff -\sqrt{a+\epsilon}<X<-\sqrt a$; by symmetry of $X$ these probabilities are equal. So by symmetry we also have $E[XY]=0$, hence $$E[XY] = 0 = 0\cdot E[Y]=E[X]E[Y].$$
To answer your explicit question about the $x^2$ in the integrals shown, note that for any suitable function $g$ we can compute the expected value of the random variable $g(X)$ via $$ E[g(X)]=\int_{-\infty}^\infty g(x) f_X(x)\,\mathrm dx.$$ Since we can compute $Y$ from $X$ via $x\mapsto |x|$, we can compute $XY$ via $g(x)=x\left|x\right|=\begin{cases}x^2&\text{if $x\ge0$}\\-x^2&\text{if $x<0$}\end{cases}$. Hence $$ E[XY]=\int_{-\infty}^\infty g(x)f_X(x)\mathrm dx = \int_{-\infty}^0(-x^2)f_X(x)\mathrm dx+\int_0^\infty x^2f_X(x)\,\mathrm dx$$ After taking into account the symmetry of $f_X$ (and using the existence of all integrals we encounter) this cancels and (again) shows $E[XY]=0$.