We work in an infinite Hilbert space $H$.
Let $(x_k)$ an arbitrary linearly independent sequence, then we define $$e_1=\frac{x_1}{\lVert x_1\Vert}\quad\text{and}\quad e_k=\frac{x_k-\sum_{j<k}\langle x_k, e_j\rangle e_j}{\lVert x_k-\sum_{j<k}\langle x_k, e_j\rangle e_j \Vert}\quad (k\ge 2).$$ For construction $(e_k)$ is an ortonormal sequence.
I must prove that $$\text{span}(e_1, \dots, e_k)=\text{span}(x_1,\dots, x_k)\quad\forall k\ge 1\tag 1.$$
First, for indution on $k$ we prove that $$(e_1,\dots, e_k)\subseteq \text{span}(x_1,\dots, x_k)\tag 2.$$ For $k=1$ we have that $(e_1)\subseteq\text{span}(x_1)$ for the definition of $e_1$. Suppose that $(e_1,\dots, e_k)\subseteq \text{span}(x_1,\dots, x_k)$ is true for same $k$ and we prove that $$(e_1,\dots, e_{k+1})\subseteq \text{span}(x_1,\dots, x_{k+1}).$$
At this point I have problems, because I don't know how to do it after doing the following:
$$\{e_1,\dots, e_{k+1}\}=\{e_1, \dots, e_k\}\cup \{e_{k+1}\}\subseteq\text{span}(x_1,\dots, x_k)\cup \{e_{k+1}\}.$$
From $(2)$ follow that $$\text{span}(e_1,\dots, e_k)\subseteq \text{span}(x_1,\dots, x_k).$$
On the other hand the vectors $e_1, \dots, e_k$ are linearly independent since they are ortogonal. Therefore $$\dim\text{span}(e_1,\dots, e_k)=k=\dim\text{span}(x_1,\dots, x_k),$$ from which follows $(1)$.
Could you help me complete the proof of $(2)$?
For your inductive step, you have that $$ e_{k+1}=\beta_{k+1}x_{k+1}-\sum_{j=1}^k\beta_je_j $$ for certain coefficients $\beta_1,\ldots,\beta_{k+1}$. The inductive hypothesis gives you that $$ \sum_{j=1}^k\beta_je_j=\sum_{j=1}^k\gamma_jx_j $$ for certain coefficients $\gamma_1,\ldots,\gamma_k$. Then $$ e_{k+1}=\beta_{k+1}x_{k+1}-\sum_{j=1}^k\gamma_jx_j\in\operatorname{span}\{x_1,\ldots,x_{k+1}\}. $$ That completes the induction.