Let $f$ be a periodic function such that it has a (non-zero) fundamental period (Smallest nonzero period). Can $f(x^2)$ also be periodic?
So the constant functions and Dirichlet function are not examples we want here.
If $f$ is continuous, then it is impossible, because $f(x^2)$ fails to be uniformly continuous.