[proofplan]
We use the defining basis description of the metric topology: the sets $B_d(a,s)$ with $a \in X$ and $s > 0$ form a basis. If $U$ is open, then every point of $U$ lies in some basis element contained in $U$, giving the required ball. Conversely, if every point of $U$ contains such a ball, then $U$ is exactly the union of all those balls, hence is open because it is a union of basis elements.
[/proofplan]
[step:Unpack openness in the metric topology to obtain a ball around each point]
Let $\tau_d$ denote the metric topology induced by $d$ on $X$. By definition, the collection
\begin{align*}
\mathcal{B}_d := \{B_d(a,s) : a \in X \text{ and } s > 0\}
\end{align*}
is a basis for $\tau_d$.
Assume $U \subset X$ is open in $\tau_d$, and let $x \in U$. Since $\mathcal{B}_d$ is a basis for $\tau_d$, there exist $a \in X$ and $s > 0$ such that
\begin{align*}
x \in B_d(a,s) \subset U.
\end{align*}
Because $x \in B_d(a,s)$, we have $d(a,x) < s$. Define
\begin{align*}
r := s - d(a,x).
\end{align*}
Then $r > 0$. If $y \in B_d(x,r)$, the triangle inequality gives
\begin{align*}
d(a,y) \le d(a,x) + d(x,y) < d(a,x) + r = s.
\end{align*}
Thus $y \in B_d(a,s)$, so $B_d(x,r) \subset B_d(a,s) \subset U$. Therefore, for this $x \in U$, there exists $r > 0$ such that $B_d(x,r) \subset U$.
[/step]
[step:Write the set as a union of the balls contained in it]
Assume that for every $x \in U$ there exists $r > 0$ such that $B_d(x,r) \subset U$. Define the indexing family
\begin{align*}
\mathcal{A} := \{B_d(x,r) : x \in U,\ r > 0,\ B_d(x,r) \subset U\}.
\end{align*}
We claim that
\begin{align*}
U = \bigcup_{A \in \mathcal{A}} A.
\end{align*}
First, if $z \in \bigcup_{A \in \mathcal{A}} A$, then $z \in A$ for some $A \in \mathcal{A}$. By the definition of $\mathcal{A}$, every such $A$ satisfies $A \subset U$, so $z \in U$.
Conversely, let $z \in U$. By the assumed ball condition, there exists $\rho > 0$ such that $B_d(z,\rho) \subset U$. Hence $B_d(z,\rho) \in \mathcal{A}$, and since $d(z,z)=0<\rho$, we have $z \in B_d(z,\rho)$. Therefore $z \in \bigcup_{A \in \mathcal{A}} A$.
[guided]
We want to prove that $U$ is open, and the metric topology is built from open balls. The natural way to connect the hypothesis to openness is to express $U$ as a union of open balls already known to lie inside $U$.
Define
\begin{align*}
\mathcal{A} := \{B_d(x,r) : x \in U,\ r > 0,\ B_d(x,r) \subset U\}.
\end{align*}
This family contains exactly the open balls whose centers are points of $U$ and whose whole contents remain inside $U$.
We prove the equality
\begin{align*}
U = \bigcup_{A \in \mathcal{A}} A.
\end{align*}
For the inclusion from right to left, suppose $z \in \bigcup_{A \in \mathcal{A}} A$. Then $z \in A$ for some $A \in \mathcal{A}$. By the defining property of $\mathcal{A}$, this particular set $A$ is contained in $U$. Hence $z \in U$.
For the inclusion from left to right, suppose $z \in U$. The hypothesis says that there exists $\rho > 0$ such that
\begin{align*}
B_d(z,\rho) \subset U.
\end{align*}
Therefore $B_d(z,\rho)$ belongs to $\mathcal{A}$. Since $d(z,z)=0<\rho$, the center $z$ lies in its own open ball:
\begin{align*}
z \in B_d(z,\rho).
\end{align*}
Thus $z$ lies in one of the sets being unioned, so
\begin{align*}
z \in \bigcup_{A \in \mathcal{A}} A.
\end{align*}
The two inclusions prove the desired union representation.
[/guided]
[/step]
[step:Conclude openness from the union representation]
Each element of $\mathcal{A}$ is an open ball, hence is a basis element for the metric topology $\tau_d$. Therefore each element of $\mathcal{A}$ is open in $\tau_d$. Since arbitrary unions of open sets are open in a topology, the equality
\begin{align*}
U = \bigcup_{A \in \mathcal{A}} A
\end{align*}
shows that $U$ is open in $\tau_d$.
If $U=\varnothing$, the quantified ball condition is vacuous and $\varnothing$ is open by the axioms of a topology. This completes both implications.
[/step]