Why: A holomorphic function with constant magnitude must be constant.
If $|f|$ is constant, then the image of $f$ is a subset of a circle in $\mathbb{C}$. Apply the Open Mapping Theorem.
Let $f(z) = u(x,y) + iv(x,y)$, where $u(x,y),v(x,y) \in \mathbb{R}$. We then have that $$\lvert f \rvert^2 = u(x,y)^2 + v(x,y)^2 = \text{constant}$$ Hence, $$\frac{\partial (u^2 + v^2) }{\partial x} = 0 = \frac{\partial (u^2 + v^2) }{\partial y}$$ This implies $$u \frac{\partial u}{\partial x} + v \frac{\partial v}{\partial x} = 0 = u \frac{\partial u}{\partial y} + v \frac{\partial v}{\partial y}$$ Making use of the Cauchy-Riemann equations, we get $$u \frac{\partial v}{\partial y} + v \frac{\partial v}{\partial x} = 0 = -u \frac{\partial v}{\partial x} + v \frac{\partial v}{\partial y}$$ Multiply the left equation by $u$ and the right equation by $v$ and add them up to get $$(u^2 + v^2) \frac{\partial v}{\partial y} = 0$$ If $u^2+v^2 = 0$, then $f=0$ throughout the domain since $\lvert f \rvert = \text{constant}$. If $u^2+v^2 \neq 0$, then $\dfrac{\partial v}{\partial y}=0$ which also gives us $\dfrac{\partial v}{\partial x}=0$. Now by Cauchy-Riemann, we also get that $\dfrac{\partial u}{\partial x}=\dfrac{\partial u}{\partial y}=0$. Hence, $f'(z) = 0$ which gives us that $f$ is constant.
Also if $f(z)$ happens to be entire, then the conclusion immediately follows from Liouville's theorem.
Pete's answer is quite sufficient, but I'll add another one which applies to more general maps (namely, complex-valued harmonic). Write $f=u+iv$, where $u$ and $v$ are real harmonic functions. As an exercise with the chain rule, verify the identity $$\Delta(u^2+v^2)=2|\nabla u|^2+2|\nabla v|^2$$ Conclude that if $u^2+v^2$ is constant, then so are $u$ and $v$.