A function $f\colon[-1,1]\to\mathbb R$ is a polynomial if and only if it is infinitely differentiable (with one-sided derivatives at the endpoints) and for some $n\in\mathbb N$ the function $f^{(n)}$ is a constant.
The minimal such $n$ is the order of the polynomial.
Side remarks:
(1) Alternatively, you can demand that $f^{(n)}\equiv0$, but then the minimal $n$ is the order plus 1.
(2) The order statement fails when $f\equiv0$, but this is the only exception. Since it is rather uninteresting, I will tacitly exclude the case.
(3) To prove this characterization of polynomials, first show that a polynomial has all the required properties.
Then, if $f$ is as above, you can compute the indefinite integral of $f^{(n)}$ with the constants $n$ times to get $f(x)$.
Your function $g$ is not a polynomial because it is not differentiable at the origin.
Your function $f$ is smooth outside the origin.
It is also differentiable at the origin, and the derivative is
$$
f'(x)
=
\frac{1}{(1+|x|)^2}
.
$$
Now this $f'$ is not differentiable at the origin, so $f$ cannot be a polynomial.
(Alternatively, you could argue that the second derivative of a polynomial would be continuous, but in this case the limits from different sides of the origin are $\pm2$.)
In this particular case, the functions are not polynomials because they are not smooth enough.
If you want to show that something is a polynomial, it is often most convenient to use the definition and express the function in an appropriate power sum form.