One can also argue algebraically.

First of all, the unit circle $S^1$ in $\mathbf C$ is a real algebraic curve in $\mathbf R^2$. Its complexification $S^1_{\mathbf C}$ in $\mathbf C^2$ is the complex projective line minus two complex conjugate points. A convenient model for $S^1_{\mathbf C}$ is $\mathbf{P}_{\mathbf C}^1\setminus\{0,\infty\}$, with complex conjugation acting as $z\mapsto1/\bar z$. The algebraic endomorphisms of the latter are the endomorphisms of the form $z\mapsto wz^m$ with $w$ a nonzero complex number and $m$ an integer. Such an endomorphism commutes with complex conjugation if and only if $|w|=1$. This will be useful below.

Another useful fact is that the set of algebraic morphisms from $S_{\mathbf C}^1$ into $\mathbf C^2$ that commute with complex conjugation can be identified with the $\mathbf C$-algebra $\mathbf C[z,1/z]$ of Laurent polynomials. Indeed, both coincide with the set of real polynomial maps from $S^1$ into $\mathbf R^2=\mathbf C$.

Now, the complex polynomial $P\in\mathbf C[z]$ is a real polynomial endomorphism of $\mathbf R^2$, and complexifies to a complex polynomial endomorphism $P_{\mathbf C}$ of $\mathbf C^2$. Assuming that $P$ is nonconstant, the image of $S_{\mathbf C}^1$ by $P_{\mathbf C}$ is an affine complex algebraic curve in $\mathbf C^2$ since $P$ is a polynomial. Moreover, it is real in the sense that it is stable for complex conjugation on $\mathbf C^2$. To put it otherwise, it is the complexification $C_{\mathbf C}$ of a real algebraic curve $C$ in $\mathbf R^2$. The curve $C$ contains the real curve $P(S^1)$, but is not necessarily equal to it. The complement of $P(S^1)$ in $C$ is a finite set of points. The normalization $\tilde C_{\mathbf C}$ of $C_{\mathbf C}$ is an open affine subset of ${\mathbf P}_{\mathbf C}^1$. Since $P$ is a polynomial, the complement of $\tilde C_{\mathbf C}$ in ${\mathbf P}_{\mathbf C}^1$ is a doubleton. We may assume that $\tilde C_{\mathbf C}$ is ${\mathbf P}_{\mathbf C}^1\setminus\{0,1\}$. The complex conjugation on $C_{\mathbf C}$ induces a complex conjugation on ${\mathbf P}_{\mathbf C}^1\setminus\{0,1\}$. Since $P(S^1)$ is compact, this complex conjugation is the same as the one above, i.e., there is an isomorphism from $\tilde C_{\mathbf C} $ to $S_{\mathbf C}^1$ that commutes with complex conjugation. Using the facts recalled above, it follows that there are a complex Laurent polynomial $f\in\mathbf C[z,1/z]$ and a nonzero integer $n$ such that $P(z)=f(z^n)$ on $S^1$, and $f_C$ is a birational morphism from $S_{\mathbf C}^1$ to $C_{\mathbf C}$. Of course, one may assume that $n$ is a natural number. The Laurent polynomial $f$ is then a true polynomial. Since $f_{\mathbf C}$ is birational, one has a rational map $f_{\mathbf C}^{-1}\circ Q_{\mathbf C}$ of $S_{\mathbf C}^1$ into itself. This rational map is a true endomorphism since $S_{\mathbf C}^1$ is nonsingular, $f_{\mathbf C}$ is the normalization morphism from $S_{\mathbf C}^1$ to $C_{\mathbf C}$ and $Q$ is a polynomial. It follows that there are a nonzero integer $m$ and a complex number $w$ with $|w|=1$ such that $f^{-1}\circ Q(z)=wz^m$ on $S^1$, i.e. $Q(z)=f(wz^m)$ on $S^1$. Of course, the integer $m$ is natural and one has $Q(z)=f(wz^m)$ on $\mathbf C$.