I would like to know if the proof is correct.
Let f : (X, $d_X$) → (Y, $d_Y$) be a function between the metric spaces (X, $d_X$) and (Y, $d_Y$). Prove that f is continuous if and only if for all x ∈ X and for all ε > 0 there exists δ > 0 such that for all y ∈ X : $d_X$(x,y) < δ ⇒ $d_Y$(f(x),f(y)) < ε.
Proof : From the topology, f is continuous if and only if for every open set U in (Y, $d_Y$), $f^{-1}$(U) is open in (X, $d_X$).
Suppose f is continuous, for x ∈ X and ε > 0 and let U = $B_{d_Y}$(f(x), ε) be a open set in (Y, $d_Y$) then $f^{-1}$(U) = $f^{-1}$($B_{d_Y}$(f(x), ε)) open in (X, $d_X$). For x ∈ $f^{-1}$(U) = $f^{-1}$($B_{d_Y}$(f(x), ε)) there exists a δ > 0 such that $B_{d_X}$(x, δ) ⊆ $f^{-1}$($B_{d_Y}$(f(x), ε)) because $f^{-1}$($B_{d_Y}$(f(x), ε)) open in (X, $d_X$). This implies that for every y ∈ $B_{d_X}$(x, δ) ⇒ y ∈ $B_{d_Y}$(f(x), ε) then $d_X$(x,y) < δ ⇒ f(y) ∈ $B_{d_Y}$(f(x), ε) then $d_X$(x,y) < δ ⇒ $d_Y$(f(x),f(y)) < ε.
Suppose for every x ∈ X and for every ε > 0, there exists δ > 0 such that for every y ∈ X, $d_X$(x,y) < δ ⇒ $d_Y$(f(x),f(y)) < ε. Let U = $B_{d_Y}$(f(x), ε) be a open set in (Y, $d_Y$), then we have to show that $f^{-1}$(U) = $f^{-1}$($B_{d_Y}$(f(x), ε)) is open in (X, $d_X$). Let y ∈ $f^{-1}$(U) = $f^{-1}$($B_{d_Y}$(f(x), ε)) ⇒ f(y) ∈ $B_{d_Y}$(f(x), ε)) ⇒ $d_Y$(f(x),f(y)) < ε then there exists δ > 0, we have to show $B_{d_X}$(x, δ) ⊆ $f^{-1}$($B_{d_Y}$(f(x), ε)). Let x ∈ $B_{d_X}$(y, δ) ⇒ $d_X$(x,y) < δ ⇒ $d_Y$(f(x),f(y)) < ε ⇒ f(x) ∈ $B_{d_Y}$(f(y), ε)) ⇒ x ∈ $f^{-1}$($B_{d_Y}$(f(x), ε)). Hence, $f^{-1}$(U) = $f^{-1}$($B_{d_Y}$(f(x), ε)) is open in (X, $d_X$).
The second part of your proof is not correct because instead of taking an arbitrary open set $U$ you take an open ball centered at $f(x)$ for some $x,$ which we shall call old. Moreover, after taking $y$ in the inverse image of that ball, you make a flawed reasoning about some new $x$ in $B(y,\delta)$ where $\delta$ is associated (by the hypothesis) to the old $x,$ pretending both $x$'s are the same.