Let $\pi:X\to X/\!\!\!\sim\;$ denote the projection map associated with $\sim$. (That is, for any $x\in X$, $\pi(x)$ is the $\sim$-equivalence class that $x$ belongs to.) Let $\nsim\; \subseteq X \times X$ be shorthand for the complement of $\;\;\sim\;\;$ in $X \times X\;$, i.e. $\nsim\;\;=\;(X \times X\;) \;\;-\; \sim\;$.
Suppose that $\pi(x) \neq \pi(y)\;$. (Here I'm relying on the fact that, since $\pi$ is surjective, any element $\widetilde{z}\in X/\!\!\!\sim\;$ may be written in the form $\pi(z)$, for some $z \in X$.) We must show that there exist open sets $U_{\pi(x)}, U_{\pi(y)} \subseteq X/\!\!\!\sim\;$ such that ${\pi(x)} \in U_{\pi(x)}$, ${\pi(y)} \in U_{\pi(y)}$, and $U_{\pi(x)} \cap U_{\pi(y)} = \varnothing\;$.
By assumption, $\;\sim\; \subseteq X \times X$ is closed, so $\nsim\; \subseteq X \times X$ is open. Therefore there exist open neighborhoods $N_x$ and $N_y$ of $x$ and $y$, respectively, such that $(x,\;y)\in N_x \times N_y \subseteq$$\;\;\nsim\;$. (This is because the family of all pairwise products of open subsets of $X$ is a basis for the product topology on $X \times X$.)
For any $v, w \in X$,
$$
(v,\;w) \;\in \;\nsim \;\;\;\;\;\Leftrightarrow\;\;\;\;\;
\pi(v) \neq \pi(w)\;\;.
$$
Therefore,
$$
N_x \times N_y \subseteq \;\;\nsim\;\;\;\;\Leftrightarrow\;\;\;\;
\forall (v, w) \in N_x \times N_y \;[\pi(v) \neq \pi(w)] \;\;\;\;\Leftrightarrow\;\;\;\;
\pi[N_x] \cap \pi[N_y] = \varnothing
$$
Furthermore, since $\pi$ is open (by assumption), the image sets $\pi[N_x], \pi[N_y] \subseteq X/\!\!\!\sim\;$ are open neighborhoods of ${\pi(x)}$ and ${\pi(y)}$, respectively. Therefore, $\pi[N_x]$ and $\pi[N_y]$ are the desired open neighborhoods $U_{\pi(x)} \ni {\pi(x)}, U_{\pi(y)} \ni {\pi(y)}$.