Let $B$ be a complex Banach algebra. Let now $f\in \mathcal{C}(B)$ and $X$ be a compact subset in $B.$ Is there any version of the Stone Weierstrass theorem which asserts that we can approximate $f$ by a polynomial on $X$?
Thank you for any hint and reference.
$\newcommand\B{\mathcal B}$ (To clarify: The OP intended for the notation to mean that $f$ was a continuous function from $\B$ to $\B$.)
No. Not even for the nicest Banach algebras you can imagine (say, finite-dimensional $C^*$ algebras).
Let $K=\{0,1\}$, with the discrete topology, and let $\B=C(K)$, the algebra of continuous complex-valued functions on $K$. Define $f:\B\to\B$ by $$f(\phi)(x)=\phi(1)\quad(\phi\in \B,x\in K).$$
There do not even exist polynomials that converge to $f$ pointwise on $\B$, much less uniformly on compact subsets of $\B$.
By definition, if $P$ is a polynomial and $\phi\in C(K)$ then $$(P(\phi))(x)=P(\phi(x))\quad(x\in K).$$So if $\phi\in C(K)$ and $P_n(\phi)\to f(\phi)$ we have $$\phi(1)=f(\phi)(0)=\lim_{n\to\infty}P_n(\phi(0)).$$If this holds for every $\phi\in C(K)$ then $$\lim_{n\to\infty}P_n(z)=w$$for every $z,w,\in\Bbb C$.
Oops: Ok, the question didn't require a sequence of polynomials that converged to $f$ on every compact set; the sequence of polynomials could depend on $X$. The above is still a counterexample: Let $X=\{\phi,\psi\}$, where $\phi(1)\ne\psi(1)$ and $\phi(0)=\psi(0)$. Then the argument above shows there is no sequence of polynomials such that $P_n(\phi)\to f(\phi)$ and also $P_n(\psi)\to f(\psi)$. (Because that would imply $\phi(1)=\lim P_n(\phi(0))=\lim P_n(\psi(0))=\psi(1)$.)