It is the same $f(x):=x^2\sum\limits_{k=0}^\infty(\cos x)^k$ than $g(x):=\sum\limits_{k=0}^\infty x^2(\cos x)^k$? It is the same $f(x):=x^2\sum\limits_{k=0}^\infty(\cos x)^k$ than $g(x):=\sum\limits_{k=0}^\infty x^2(\cos x)^k$? 
It seems that $f(0)$ is not defined because $\sum_{k=0}^\infty 1^k=\infty$, however $g(0)=0$! There is something wrong with this reasoning or this is a case where normal arithmetic fails with series?

They are same. The key is to remember that:
\begin{align*}
\sum_{k=1}^{\infty}a_k = \lim_{n\rightarrow\infty}\sum_{k=1}^{n}a_k
\end{align*}
If you consider the sequence:
\begin{align*}
(a_n) = \{0^2\cdot1, 0^2\cdot(1+1), 0^2\cdot(1+1+1), \cdots\} = \{0, 0, 0, \cdots\}
\end{align*}
You will see that for each $n\in \mathbb{N}, a_n = x^2\sum_{k=0}^{n}\cos^k(x)$, when $x = 0$. This shows that:
\begin{align*}
f(0) = \lim_{n\rightarrow\infty}x^2\sum_{k=1}^{n}\cos^k(x) = \lim_{n\rightarrow\infty}a_n = \lim_{n\rightarrow\infty}0 = 0
\end{align*}
