I will sketch a classical approach.
Lemma 1. If $N$ is a square-free positive integer, the continued fraction of $\alpha=\sqrt{N}$ has the following structure: $\alpha=[M,\overline{s,2M}]$ where $s$ is a palyndromic string of positive integer.
I believe this Lemma dates back to Lagrange and Brouncker. Stein outlines a proof here.
This Lemma is essentially equivalent to the fact that the class number of $\mathbb{Q}(\sqrt{D})$ is finite.
By exploiting the structure of continued fractions one may prove that $\frac{p}{q}=[M,s]$ is such that $p^2-Nq^2=1$. As an alternative, one may use the approach shown by Booher at page 8 here. There are an infinite number of convergents since $\sqrt{N}$ is irrational, and only a finite number of choices for $p^2- Nq^2$, so there must be an $r$ with an infinite number of convergents satisfying $p^2 − Nq^2= r$.
There are only a finite number of choices for $(p, q)$ to reduce to modulo $r$, and an infinite number of convergents satisfying the equation, so there are two distinct convergents $(p_0 , q_0 )$ and $(p_1 , q_1 )$ with
$p_0\equiv p_1\pmod{r}$ and $q_0\equiv q_1\pmod{r}$ and $p_0^2-Nq_0^2 =p_1^2-Nq_1^2 = r$. Thus we may consider the ratio
$$ u=\frac{p_0+q_0\sqrt{N}}{p_1+q_1\sqrt{N}}=\frac{p_0p_1-Nq_0q_1+\sqrt{N}(p_1 q_0-p_0 q_1)}{r} $$
and notice that $p_0 p_1 − N q_0 q_1 \equiv p_0^2-Nq_0^2 \equiv 0\pmod{r}$ and $ p_1 q_0 − q_1 p_0 \equiv 0 \pmod{r}$, hence $u$ is of the form $p+qN$ with $p,q\in\mathbb{Z}$. Since the norm on $\mathbb{Q}(\sqrt{d})$ is multiplicative (aka Brahmagupta's identity), $u$ has norm 1. Therefore Pell’s equation has a non-trivial solution and $\mathbb{Z}[\sqrt{d}]$ has an infinite number of invertible elements.