There's another question that's been marked as a duplicate of this one. The other question asks specifically what the difference is between $\Bbb R$ and $\Bbb C$ here - it seems possibly worthwhile to transplant the answer I gave to the other questions:
In either case $$f(z+h)=f(z)+hf'(z)+\dots,$$where the dots indicate higher order terms that are smaller than the last term if $h$ is small. Now if $f'(z)\ne0$ this shows that $|f|$ cannot have a maximum at $z$, because we can choose $h$ to point in the right direction so $|f(z)+hf'(z)|>|f(z)|$.
But what if $f'(z)=0$? Then $$f(z+h)=f(z)+\frac12h^2f''(z)+\dots.$$In the real case $h^2\ge0$, so if $f''(z)$ has the opposite sign to $f(z)$ then adding the $h^2f''(z)$ makes $|f|$ smaller. But in the complex case $h^2$ can point in any direction; so if we choose the direction for $h^2f''(z)$ to be the same as the direction of $f(z)$ then adding the $h^2f''(z)$ again makes $|f|$ larger.
Hmm, slightly more formally: If $f'(z)\ne0$ then $z$ cannot be a maximum for $|f|$, for very much the same reason in the real and complex case. Suppose that $f'(z)=0$, $f''(z)\ne0$. Now in the real case, if $f(z)>0$ and $f''(z)<0$ then $$|f(z)+\frac12 h^2f''(z)|
=|f(z)|-\frac12h^2|f''(z)|<|f(z)|$$ for all small $h\ne0$, regardless of whether $h$ is positive or negative, the only two directions available. But that can't happen in the complex case: If $f''(z)\ne0$ then there exists $\alpha$ so that if $h=re^{i\alpha}$ then $$|f(z)+\frac12h^2f''(z)|=|f(z)|+r^2|f''(z)|>|f(z)|$$ for all small $r>0$.