I am currently reading the book "Visual Complex Analysis". It's a great book so far, but already in the beginning the proof of the identity theorem seems dubious. I mean, it's known from high-school algebra, that you're not allowed to divide by z if you set z = 0.
Isn't this proof completely wrong? Some friends I've asked even told me that this theorem is wrong in the reals, so wouldn't a correct proof have to use properties of the complex numbers? Is it even possible to prove this with elementary methods? I've seen proofs that use properties of holomorphic functions but haven't gotten that far in my book yet, so I have no experience with holomorphic functions.

The theorem is true, and the proof is valid. However, it does omit a little step which is subtle. We have, thanks to the first part of the proof that $$\sum_{k=1}^\infty c_k z^k=\sum_{k=1}^\infty d_k z^k\\ z\left(\sum_{k=1}^\infty c_k z^{k-1}\right)=z\left(\sum_{k=1}^\infty d_k z^{k-1}\right)$$
Here comes the subtle part: for every $z\neq 0$, we have that
$$\sum_{k=1}^\infty c_k z^{k-1}=\sum_{k=1}^\infty d_k z^{k-1}$$
Since the two power series are continuous and are equal on a punctured neighbourhood of $0$, they must be equal at $0$ too. In fact:
$$c_1=\lim_{z\to 0}\sum_{k=1}^\infty c_k z^{k-1}=\lim_{z\to 0}\sum_{k=1}^\infty d_k z^{k-1}=d_1$$
The rest of the proof follows similarly
As a side note, the identity principle, is a feature of analytic functions in general and does not depends on their domain being $\mathbb{R}$ or $\mathbb{C}$
As I mentioned, this proof lacks of rigour. This is an intentional choice of the author through the book, as he states in the introduction: