I'm studying this theorem (Zorich, Mathematical Analysis II, 1st ed., pag.145):
whose proof begin in this way:
where my doubt is on the highlighted relation.
As a counterexample, I'm imagining:
$D_x=(-2,2)$
$S_x=\left\{\frac{1}{n}\right\}_{n\in\mathbb{N}}$
so $x=0$ is a boundary point of $S_x$ that is not in $S_x$, neither in $\partial D_x$.


You are forgetting that $S_x$ is a subset of $D_x$. [ See lines 2-3 of Theorem 2]. We have $\partial S_x \subseteq (D_x\setminus S_x)^{c}=S_x \cup D_x^{c}$. Since $S_x \subseteq D_x$ this gives $\partial S_x \subseteq S_x \cup (D_x^{c}\cap \overline {D_x}) $ (because $\overline {S_x} \subseteq \overline {D_x}$). Hence $\partial S_x \subseteq S_x \cup \partial D_x$.
For the sentence before the highlighted sentence note that an open set disjoint from $S_x$ cannot intersect the boundary of $S_x$.