distance between a point and a set or closure of it
I will be using the notation $\overline{A}$ to mean the closure of set $A$.
Let $y\in \overline{A}$. Using the result found in here, we get $d(y,A)=0$. Let $\epsilon>0$. Then $\epsilon >d(y,A)$. Thus, there exits $a\in A$ such that $d(y,a)<\epsilon$. Thus $$d(x,A)\leq d(x,a)\leq d(x,y)+d(y,a)<d(x,y)+\epsilon.$$
Hence, $$d(x,A)< d(x,y)+\epsilon\quad \text{for all }\epsilon>0.$$
Hence,
$$d(x,A)\leq d(x,y).$$
Thus, $$d(x,A)\leq d(x,y)\quad \text{for all }y\in\overline{A}.$$
Hence, $$d(x,\overline{A})=\inf\{d(x,y):y\in\overline{A}\}\geq d(x,A).$$
You already said that $d(x,\overline{A})\leq d(x,A)$ is obvious.
Hope this help.
Let $f: X\to \Bbb R$ the continuous function given by $f(y)=d(x,y)$. You want to calculate $d(x,A)=\inf f(A)$. Since $f$ is continuous, $\newcommand{cl}{\operatorname{cl}}f^{-1}(\cl(f(A)))\supseteq\cl A$.
So $f(\cl(A))\subseteq f(f^{-1}(\cl(f(A))))\subseteq\cl f(A)$. Hence, $d(x,\cl A)=\inf f(\cl(A))\ge \inf\cl f(A)$.
However, since the $\inf$ of a subset of $\Bbb R$ is the least limit of a sequence in it, it holds $\inf S=\inf\cl S$. Therefore $$d(x,\cl A)=\inf f(\cl(A))\ge \inf\cl f(A)=\inf f(A)=d(x,A)$$