Stone-Weierstrass theorem on closed interval $[a, b]$ (in $\mathbb{R}$) states that any continuous function $f$ on $[a, b]$ can be approximated by polynomial function $p$, arbitrarily close to $f$.
From the above observation, I wonder if this can directly be applied to multidimensional case: is it true that any continuous function $f:X \rightarrow \mathbb{R}^m$, where $X \subset \mathbb{R}^n$ is compact, can be approximated by polynomial function $p$, i.e., $$\forall x\in X, \|f(x) - p(x)\|< \epsilon ?$$ If so, please show me a detailed example (qualitatively).
The standard statement of the Stone-Weierstrass theorem is the following: let $X$ be a compact Hausdorff topological space, and $\mathcal A$ a subalgebra of the continuous functions from $X$ to $\mathbb R$ which is closed under complex conjugation and separates points ($\forall x_1\neq x_2\in X, \exists f\in\mathcal A$ such that $f(x_1)\neq f(x_2)$). Then $\mathcal A$ is dense in $C(X,\mathbb R)$ in the supremum norm.
Let's specify to your example, where $X$ is a closed, bounded subset of $\mathbb R^n$, and we have the subalgebra of polynomial functions (functions which are polynomial in each variable). These are certainly continuous, and closed under addition and pointwise multiplication, which is the multiplication of functions. The only difficulty is showing that it separates points. For two points $\vec x=(x_1,\ldots,x_n)$ and $\vec y=(y_1,\ldots,y_n)$, if they are not equal, then they are not equal for some index $i$, and the polynomial function $p(x_1,\ldots,x_n)=x_i$ separates them. So this subalgebra is dense.