@Wolfi , your proof is correct (except for a minor typo). Please note that in the context of Hilbert and Banach space, "subspace" means "linear subspace" and any linear subspace $M$ of $X$ is a convex subset of $X$. In fact, if $M \subset X$ is a subspace, then for all $x,y \in M$ and all $\lambda \in [0,1]$, we have $\lambda x +(1-\lambda) y \in M$.
So actually your proof proves a generalization of the original question.
Original Question: Suppose $X$ is a Hilbert space, $M\subset X$ is a closed subspace and $y\notin M$. Let $d = \inf\{ \|x-y\|:x\in M\}$ show that if $\{x_n\}_{1}^{\infty}$ and $\lim_{n\rightarrow \infty}\|x_n - y\| = d$ then $\{x_n\}$ is Cauchy.
Proof - Let $\{x_n\}_{1}^{\infty}\subset M$ such that $\lim_{n\rightarrow \infty}\|x_n - y\| = d$ with $d = \inf\{ \|x-y\|:x\in M\}$. By the parallelogram law $$\lVert x_n - x_m\rVert^2 = 2\lVert x_n\rVert^2 + 2\lVert x_m\rVert^2 - \lVert x_n + x_m\lVert^2$$
Since $M$ is subspace of $X$ we have that $\frac{1}{2}( x_n + x_m)\in M$. Therefore, $\lVert \frac{1}{2}(x_n + x_m)\rVert \geq d$ hence $$\lVert x_n - x_m\rVert^2 = 2\lVert x_n\rVert^2 + 2\lVert x_m\rVert^2 - 4d^2$$ As $m,n\rightarrow \infty$, this quantity goes to zero, therefore $\{x_n\}$ is a Cauchy sequence.
Broader Question: Suppose $X$ is a Hilbert space, $M$ is a closed convex subset of $X$ and $y\notin M$. Let $d = \inf\{ \|x-y\|:x\in M\}$ show that if $\{x_n\}_{1}^{\infty}$ and $\lim_{n\rightarrow \infty}\|x_n - y\| = d$ then $\{x_n\}$ is Cauchy.
Proof - Let $\{x_n\}_{1}^{\infty}\subset M$ such that $\lim_{n\rightarrow \infty}\|x_n - y\| = d$ with $d = \inf\{ \|x-y\|:x\in M\}$. By the parallelogram law $$\lVert x_n - x_m\rVert^2 = 2\lVert x_n\rVert^2 + 2\lVert x_m\rVert^2 - \lVert x_n + x_m\lVert^2$$
If $M$ is convex then $\frac{1}{2}(x_n + x_m)\in M$. Therefore, $\lVert \frac{1}{2}(x_n + x_m)\rVert \geq d$ hence $$\lVert x_n - x_m\rVert^2 = 2\lVert x_n\rVert^2 + 2\lVert x_m\rVert^2 - 4d^2$$ As $m,n\rightarrow \infty$, this quantity goes to zero, therefore $\{x_n\}$ is a Cauchy sequence.
Remark 1: As I mentioned in the beginning of this answer, the original question is a corollary of the broader question.
Remark 2: Since we want to prove that $\{x_n\}$ is a Cauchy sequence, we needed not use (in both questions) the assumption that $M$ is closed. Such assumption is required to conclude that $\{x_n\}$ converges to some $x\in M$.