Solution (source code)

= Solution

For each positive integer $i$, apply the <Stone-Weierstrass theorem> on the closed ball $\overline B(0,i)$ to choose a polynomial $p_i$ in $n$ variables satisfying
$$
\sup_{|x|\leq i}|p_i(x)-f(x)|<\frac1i.
$$
Every compact $B\subset\mathbb R^n$ lies in some such ball, so the same estimate for all sufficiently large $i$ proves that $p_i|_B\to f|_B$ uniformly.

Now suppose instead that $p_i\to f$ uniformly on all of $\mathbb R^n$. For sufficiently large $i,j$, the polynomial $p_i-p_j$ is bounded on $\mathbb R^n$, and every nonconstant real polynomial is unbounded along a suitable line. Hence $p_i-p_j$ is constant. A tail of the sequence is therefore one fixed polynomial plus a uniformly convergent sequence of constants, and its limit is a polynomial. The converse is immediate from the constant sequence. Thus
$$
\boxed{\ f\text{ is a globally uniform limit of polynomials}\iff f\text{ is a polynomial}.\ }
$$
This is the <globally uniform limit of real polynomials> criterion.