Let $d(\in \Bbb Z)<-1$ such that $d$ is not divisible by the square of a prime. Prove that only units of $\Bbb Z[\sqrt d] $ are $\pm 1$.
$$a+b\sqrt d \text{ is a unit }\implies (a+b\sqrt d)(c+e\sqrt d)=1\implies (a^2-db^2)(c^2-de^2)=1\implies a^2-db^2=\pm 1\implies a+b\sqrt d=\pm1\implies a+b\sqrt d \text{ is a unit}$$
Where did we use that $d$ is not divisible by the square of a prime.
Is my proof wrong?
You're begging the question. You prove that $a^2-db^2=\pm1$, but you can't conclude right now that $a+b\sqrt{d}=\pm1$. What you can derive is that $a+b\sqrt{d}$ is a unit with inverse $\pm(a-b\sqrt{d})$.
Actually, since $d<0$, $a^2-db^2\ge0$, so you can only have $a^2-db^2=1$.
Now $a^2-db^2\ge a^2$. If this is to be equal to $1$, we need $a=0$ or $a=\pm1$. In the first case $-db^2=1$ is impossible, as $d<-1$. So $a=\pm1$ and therefore $b=0$.
There is no need to assume that $d$ is squarefree. This assumption is relevant when you want to consider $\mathbb{Q}[d]$, because this is the same as $\mathbb{Q}[d']$ where $d'$ is squarefree and $d=x^2d'$ for some integer $x$. The field $\mathbb{Q}[d]$ is obviously related to $\mathbb{Z}[d]$, being its field of quotients.