In the special case $\theta=\pi$ this reduces to Euler's Identity.
The functions cos and sin come originally from trigonometry, and it's just a little bit magical that they turn up in a purely algebraic context.
Interestingly, the formula also means that in some cases you can take logarithms of negative numbers. Specifically:
The log is not unique, though, because the same number z is represented by infinitely many values of $\theta.$