Here is another solution. The main idea is to obtain an integral estimate, and use an approximation to the identity to reduce it to a pointwise estimate.
Let $E$ be the set of points $x$ such that $x$ is a Lebesgue point of both $f$ and $g$. Since both $f$ and $g$ are locally integrable, $\mathbb{R}-E$ has measure zero.
Now choose $x\in E$ and consider a cube $C_x(r)$ of side length $r$ centered at $x$. Then
$\phi_{\epsilon}=\frac{1}{|C_{x}(\epsilon)|}\chi_{C_{x}(\epsilon)}$
lies in $L^2(\mathbb{R})\cap L^{\infty}(\mathbb{R})$, so
$(f_n,\phi_{\epsilon})\to(f,\phi_{\epsilon})\quad\text{and}\quad(f_n^2,\phi_{\epsilon})\to(g,\phi_{\epsilon}).$
By Cauchy-Schwarz inequality applied to $f_n\sqrt{\phi_{\epsilon}}\cdot\sqrt{\phi_{\epsilon}}$,
$(f_n,\phi_{\epsilon})^2=\left( \int f_n\phi_{\epsilon}\right)^2\leq\int f_n^2\phi_{\epsilon}=(f_n^2,\phi_{\epsilon}).$
Thus taking $n\to\infty$ we have
$(f,\phi_{\epsilon})^2\leq(g,\phi_{\epsilon}).$
Now taking $\epsilon\to 0$ gives $f^2(x)\leq g(x)$, completing the proof.
P.S. I saw a same question on AoPS. I hope that my answer is not a duplicate.