Find all such functions $g:[a,b]\to [a,b]$ such that
$g$ is continuous.
For any continuous function $f:[a,b]\to \mathbb{R}$, given $\varepsilon >0$ there is a polynomial $P_{\varepsilon}(t)$ such that $$ \sup_{t \in [a,b]}|f(t)-P_{\varepsilon}(g(t))|< \varepsilon .$$
I see that if $g$ is injective then $g:[a,b]\mapsto [c,d]$. So there is a continuous inverse $g^{-1}:[c,d]\to [a,b]$. Now we can get a polynomial $p$ such that $$|f\circ g^{-1}-p|<\varepsilon$$ on $[c,d]$. Now clearly $|(f\circ g^{-1})\circ g-p\circ g|<\varepsilon$ which finishes one side. But, I can't find other types of functions like this.
Well if $f$ is injective and $g$ is not injective, you will have $x \not= y$ such as $f(x) \not= f(y)$ and $g(x) = g(y)$. Then $P(g(x)) = P(g(y))$ and you have a problem ...