The following is one of the claims made by Theorem 2.3.2 of Anton Deitmar's "A First Course in Harmonic Analysis":
If $H$ is a pre-Hilbert space and $\left\{e_j\right\}_{j=1}^\infty\subseteq H$ is an orthonormal basis, then $h=\sum_{j=1}^\infty c_j\left(h\right)e_j$ for every $h\in H$, where $c_j:H\to\mathbb C$ is defined by $h\mapsto\langle h,e_j\rangle$.
It is proven by showing that $\sum_{j=1}^\infty\left|c_j\left(h\right)\right|^2<\infty$ for every $h\in H$, by defining $s_n:H\to H$ by $h\mapsto\sum_{j=1}^n c_j\left(h\right)e_j$, and by noting that if $m>n$, it is the case that
$$\left\|s_m\left(h\right)-s_n\left(h\right)\right\|^2=\left\|\sum_{j=n+1}^mc_j\left(h\right)e_j\right\|^2=\sum_{j=n+1}^m\left|c_j\left(h\right)\right|^2,$$
which implies that $\left(s_n\left(h\right)\right)_{n=1}^\infty$ is a Cauchy sequence in $H$, so it converges to$$s\left(h\right)=\sum_{j=1}^\infty c_j\left(h\right)e_j\in H.$$
Then it goes on to prove that $h=s\left(h\right)$, etc. However, the above statement cannot be made since $H$ was assumed to be a pre-Hilbert space—not necessarily complete.
Is this a typo? If so, can the proof be salvaged? I ask because the claim is later used to show that pre-Hilbert spaces can be embedded as dense subspaces into Hilbert spaces.
The book defines an orthonormal basis of a pre-Hilbert space as a subset $\left\{e_j\right\}_{j\in J}$ such that $\langle e_j,e_k\rangle=\delta_{j,k}$ and, for every $h\in H$, the equalities $\langle h,e_j\rangle=0$ for every $j\in J$ imply $h=0$.
You are right, the statement is not generally true if $X$ is not assumed to be a Hilbert space.
First, a useful proposition:
For a counterexample to your statement, consider a Hilbert space $H$ with an orthonormal basis $(e_n)_{n=1}^\infty$ for $H$. By the previous proposition, $e_0 = \sum_{n=1}^\infty \frac{1}{n} e_n \in H$.
Define $X = \operatorname{span}\left\{e_0, e_2, e_3, \ldots \right\}$. Notice that $X$ is not complete.
Indeed, consider the sequence $\left(e_0 - \sum_{n=2}^N\frac1n e_n\right)_{N=1}^\infty$ in $X$. By the previous proposition, it converges in $H$, so:
$$X \not\ni e_1 = e_0 - \sum_{n=2}^\infty\frac1n e_n = \lim_{N\to\infty} \left(e_0 - \sum_{n=2}^N\frac1n e_n\right)$$
Hence, $X$ is not closed in $H$ so it cannot be complete.
Now, notice that the sequence $(e_n)_{n=2}^\infty$ satisfies the property $x \perp e_n, \forall n \ge 2 \implies x = 0$:
Indeed, take $x = \alpha_0 e_0 + \alpha_2 e_2 + \ldots + \alpha_n e_n \in X$.
$$0 = \langle x, e_{n+1}\rangle = \frac{\alpha_0}{n+1} \implies \alpha_0 = 0$$ For $k \in \{2, \ldots, n\}$ we have:
$$0 = \langle x, e_k \rangle = \alpha_k + \frac{\alpha_0}k = \alpha_k \implies \alpha_k = 0$$
so $x = 0$.
However, $$X \ni e_0 \ne \sum_{n=2}^\infty \frac1n e_n = \sum_{n=2}^\infty \langle e_0, e_n\rangle e_n$$
If $X$ is assumed to be a Hilbert space, then the proof of your statement is simple if you use the above proposition.
Assume $(e_n)_{n=1}^\infty$ is an orthonormal sequence in $X$ such that $x \perp e_n, \forall n \in \mathbb{N} \implies x = 0$. Let $x \in X$ be arbitrary.
Bessel inequality gives $\sum_{n=1}^\infty |\langle x, e_n\rangle|^2 \le \|x\|^2 < +\infty$ so $\big(\langle x, e_n\rangle \big)_{n=1}^\infty \in \ell^2$. The proposition implies $x_0 = \sum_{n=1}^\infty \langle x, e_n\rangle e_n \in X$.
For any $j \in \mathbb{N}$ we have:
$$\langle x_0, e_j \rangle = \left\langle \sum_{n=1}^\infty \langle x, e_n\rangle e_n, e_j \right\rangle = \langle x, e_j\rangle$$
Hence $x_0 - x \perp e_n$ for all $n \in \mathbb{N}$. Therefore, $x = x_0 = \sum_{n=1}^\infty \langle x, e_n\rangle e_n$.