With these definitions, we have to show
$$\operatorname{dist}(x,S) = 0 \iff \bigl(\forall r > 0\bigr) \bigl(S \cap B_r(x) \neq \varnothing\bigr).$$
In the one direction, we have $0 = \operatorname{dist}(x,S) = \inf \{ d(x,s) : s \in S\}$, so that means for all $\varepsilon > 0$ there is an $s_{\varepsilon} \in S$ with $d(x,s_\varepsilon) < \varepsilon$ by the definition of $\inf$. But $d(x,s_\varepsilon) < \varepsilon \iff s_\varepsilon \in S\cap B_\varepsilon(x)$, so every ball centered at $x$ intersects $S$.
In the other direction, we have an $s_r \in S \cap B_{r}(x)$ for all $r > 0$. But $s_r \in S \cap B_r(x)$ means $d(x,s_r) < r$ and hence $\operatorname{dist}(x,S) \leqslant d(x,s_r) < r$, so we have $0 \leqslant \operatorname{dist}(x,S) \leqslant \inf \{ r \in \mathbb{R} : r > 0\} = 0$.
Regarding the converse part of the proof from the book, that shows the contrapositive
$$x \notin \operatorname{Cl}(S) \Rightarrow \bigl(\exists r > 0\bigr)\bigl(S\cap B_r(x) = \varnothing\bigr).$$
If $R := \operatorname{dist}(x,S) > 0$, then either $S$ is empty and $R = \infty$, or $S\neq\varnothing$ and $R < \infty$. In the first case, every ball centered at $x$ has empty intersection with $S$, for example $B_1(x) \cap S = B_1(x)\cap\varnothing = \varnothing$. In the second case, the assertion is that $B_R(x) \cap S = \varnothing$. For if there were an $s \in B_R(x)\cap S$, then $\operatorname{dist}(x,S) \leqslant d(x,s) < R$, contradicting the definition $R = \operatorname{dist}(x,S)$.