Lemma: $a_1\ge a_2\ge\cdots\ge a_n\ge0$ and $b_1\ge b_2\ge\cdots\ge b_n\ge0$. $\sum_{i=1}^ka_i\le\sum_{i=1}^kb_i$ for all $k$. Then $$\sum_{i=1}^na_i^2\le\sum_{i=1}^nb_i^2$$.
Proof:
Let $\ell_k= \sum_{i=1}^ka_i-\sum_{i=1}^kb_i$. The condition says $\ell_k\le0$ for all $1\le k\le n$. By definition, $\ell_0=0$. Note that $a_k-b_k=\ell_k-\ell_{k-1}$ for all $1\le k\le n$.
$$\begin{aligned}
\sum_{i=1}^na_i^2-\sum_{i=1}^nb_i^2
&=\sum_{i=1}^n(a_i+b_i)(a_i-b_i)\\
&=\sum_{i=1}^n(a_i+b_i)(\ell_i-\ell_{i-1})\\
&=(a_n+b_n)\ell_n-(a_1+b_1)\ell_0 + \sum_{i=1}^{n-1}((a_i-a_{i+1})+(b_i-b_{i+1}))\ell_i\\
&\le0
\end{aligned}$$
The lemma is a slight variant of Karamata's inequality with the convex function $f=x^2$.
The proposition in the question is the continuous variant of the lemma.
Fix a positive integer $n$. Let $\ a_i=\int_{\frac{i-1}n}^\frac in f$, $\ b_i=\int_{\frac{i-1}n}^\frac in g$ for all $1\le i\le n$.
- $f$ and $g$ are nonnegative decreasing implies $a_1\ge a_2\ge\cdots\ge a_n\ge0$ and $b_1\ge b_2\ge\cdots\ge b_n\ge0$.
- $\int_0^x f \le \int_0^x g$ holds for each $x \in [0,1]$ implies $\sum_{i=1}^ka_i=\int_0^\frac kn f \le \int_0^\frac kn g=\sum_{i=1}^kb_i$ for all $k$.
The lemma tells that
$\sum_{i=1}^na_i^2\le\sum_{i=1}^nb_i^2$. Multiplying by $n$, we have
$$\sum_{i=1}^nna_i^2\le\sum_{i=1}^nnb_i^2.$$ Letting $n\to\infty$, we obtain
$$\int_0^1f^2\le\int_0^1g^2$$
since
$$\lim_{n\to\infty}\sum_{i=1}^nna_i^2=\int_0^1f^2\quad \text{and}\quad\lim_{n\to\infty}\sum_{i=1}^nnb_i^2=\int_0^1g^2,$$ which are easy to prove
because $f$ and $g$ are monotone.
Here is a minor generalization, which can be proved similarly.
Let $f,g :[0,1] \to \mathbb R$ be nonnegative decreasing functions and suppose that $\int_0^x f \le \int_0^x g$ holds for each $x \in [0,1]$. Then we have $\int_0^1 (\phi\circ f) \le \int_0^1 (\phi\circ g)$, where $\phi$ is a nonnegative increasing convex function on $\Bbb R_{\ge0}$.