Solution (source code)

= Solution

Reverse the order in the nonnegative <double integral>, using $0\le y<\infty$ and $y\le x\le2y$. For $y>0$, an <antiderivative> in $x$ is $-(x/y+1/y^2)e^{-xy}$. Thus
$$
I=\int_0^\infty\left[\left(1+\frac1{y^2}\right)e^{-y^2}
-\left(2+\frac1{y^2}\right)e^{-2y^2}\right]dy.
$$
Let $J$ denote the requested <improper integral>. Its numerator is $y^2+O(y^4)$ near zero, so its apparent singularity is removable; it also decays at infinity. We may therefore separate the preceding expression into the convergent integrals
$$
I=\int_0^\infty(e^{-y^2}-2e^{-2y^2})\,dy+J
=\frac{\sqrt\pi}{2}(1-\sqrt2)+J=-I+J.
$$
It follows that
$$
\boxed{J=\int_0^\infty\frac{e^{-x^2}-e^{-2x^2}}{x^2}\,dx=\sqrt\pi(\sqrt2-1).}
$$
The two terms divided separately by $x^2$ would each have a divergent <integral> at zero; the cancellation in their difference is essential.