Let $A$ be a C*-algebra with self-adjoint generators $x$ and $y$. Can every element in $A$ be expressed by infinite series of powers of $x$ and $y$? i.e. if $a\in A$, then $a$ is infinite sum of $x, y, x^{2}, xy, yx ,y^{2},...$.
I thought that is possible since algebra generated by generators is dense in $A$, but someone told me it is not the case. If not, what is the reason behind this?
If what you say were true, every continuous function would be analytic.
Concretely, let $A=C\big(\overline{\mathbb D}^2\big)$, the continuous functions on two complex variables on the closed unit bidisk. The operators you postulate, that is series of the form $$ g(z,w)=\sum_{k,j=0}^\infty c_k\,z^k w^j, $$ are the analytic functions on two variables. But there exist (many) continuous functions which are not analytic, starting with $f(z)=\overline z$, all the way to nowhere differentiable functions.
This does not change the fact that (due to Stone-Weierstrass) every continuous functions is a uniform limit of polynomials. What the above means is that in general you cannot choose the sequence polynomials converging to $f$ to be the partial sums of a series.