An alternative to Carlo Beenakker's argument, which explains the appearance of $\pi$ geometrically, is as follows: With $A(t)=\sum_{n=0}^{\infty}t^{n^2}$ we have
\begin{equation}
\frac{1}{1-t}A(t)^2=\sum_{n=0}^{\infty}p(n)t^n,
\end{equation}
where $p(n)$ is the number of solutions $a^2+b^2\le n$ for nonnegative integers $a$ and $b$. Thinking of these pairs $(a,b)$ as lattice points, we see that $p(n)=\frac{\pi}{4}n+O(\sqrt{n})=\frac{\pi}{4}(n+1)+O(\sqrt{n})$. Thus
\begin{equation}
\sum_{n=0}^{\infty}p(n)t^n=\frac{\pi}{4}\frac{1}{(1-t)^2}+\sum_{n=0}^{\infty}O(\sqrt{n})t^n.
\end{equation}
Therefore
\begin{equation}
(1-t)A(t)^2=\frac{\pi}{4}+(1-t)^2\sum_{n=0}^{\infty}O(\sqrt{n})t^n.
\end{equation}
The second sum goes to $0$ for $t\nearrow 1$, for instance because for every $\varepsilon>0$, $\sqrt{n}<\varepsilon n$ for all $n>1/\varepsilon^2$.