For simplicity let assume $[a,b] = [0,1]$ and first suppose $g(x)=x$ taking into account the particular case, we have $\int_{0}^{1} f(x) p(x) = 0 $ for each $P(x) = polynomial$.
now since $f(x)$ is continuous on $[0,1]$ then there exists a sequence of polynomials, say $P_n$ such that $P_n \rightarrow f$ uniformly. This implies that
$$ 0= \int_{0}^{1} f(x) p_n (x) \rightarrow \int_{0}^{1} |f(x)|^2 $$ Hence, $\int_{0}^{1} |f(x)|^2 =0$, and because $f$ is continuous we arrive $f=0.$
Now let W.L.O.G assume $g:[0,1] \rightarrow [0,1]$ is onto (otherwise you can scale this g) this implies $0=g(0),~ 1=g(1)$ now by substitution $y=g(x)$ the condition of question becomes $$ \int_{0}^{1} F(y) y^n dy =0 $$ where $F(y) = f(g^{-1} (y)) (g^{-1} (y))' $ hence according to my pervious argument $F=0$ which implies $f=0$
Some Clarifications :
Note that since $g$ is strictly increasing so $g^{-1}$ is. And it is a well-known fact that every increasing function has almost countable non-differentiable points, thus $g^{-1}$ is differentiable a.e. Therefor it does not impact on the integrability and the value of integral. Thus this makes $F=0$ a.e and then $f=0$ a.e and since $f$ is continuous $f=0$ every where!.
P.S for those who have hard time of scaling $g$, if $[g(0) , g(1)] \neq [0,1]$ you can scale this $g$ in this way $\frac{g(x)-g(0)}{g(1)-g(0)}.$