Let $A$ denote the algebra of smooth real functions on $\mathbb{R}^n$. Let $j : \mathbb{R}[x_1,\ldots,x_n] \rightarrow A$ be the injective homomorphism sending a polynomial to its corresponding function.
Let $\mathbb{R}\langle x_1,\ldots,x_n \rangle$ denote the algebra of real-coefficient polynomials in the freely non-commuting variables $x_1,\ldots,x_n$; and let $q : \mathbb{R}\langle x_1,\ldots,x_n \rangle \rightarrow \mathbb{R}[x_1,\ldots,x_n]$ be the obvious surjective homomorphism sending each $x_i$ to $x_i$.
My question is whether there exist a real algebra (associative, unital, not commutative) $B$, and (real-linear, unital) homomorphisms $\mathbb{R}\langle x_1,\ldots,x_n \rangle \xrightarrow{f} B \xrightarrow{g} A$, such that $g \circ f = j \circ q$ and $g$ is surjective and $f$ is injective?
Not sure what your goal is, but you can always take $$ B=\mathbb{R}\langle x_1,\ldots,x_n \rangle\oplus A, $$ and $$ f(\varphi)=(\varphi,(j\circ q)\varphi),\qquad\qquad g(x,y)=y. $$