There is nothing wrong with the way you did it. The ansatz made by whoever wrote the solution is an application of separation of variables, very similar to your approach. First, though, there is an issue with your solution, which I'll address below.
To start, your eigenfunction for $T(t)$ is wrong, and certainly should not contain any terms in $x$. When solving the ODEs in $X$ and $T$, you only the apply homogeneous conditions. Once you have done that, construct your solution as a Fourier series, then apply the inhomogeneous condition.
Following above, the solution to $T'' = - c^{2} \omega^{2} T$ (where $\omega$ is the eigenvalue you found) with the homogeneous boundary condition
$$v_{t}(x,0) = 0 \implies T'(0) = 0 \tag 1$$ is given by
$$T_{n}(t) = B_{n} \cos \left( \frac{(2n+1)\pi c t}{2L} \right)$$
This yields the solution for $v$ as a Fourier series
\begin{align}
v(x,t) &= \sum_{n \ge 0} X_{n}(x) T_{n}(t) \\
&\sum_{n \ge 0} A_{n} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \cos \left( \frac{(2n+1)\pi c t}{2L} \right) \tag 2
\end{align}
Substituting in the inhomogeneous boundary condition, we find
\begin{align}
v(x,0) &= \sum_{n \ge 0} A_{n} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \\
&= -u_{\text{stat}}(x) \tag 3
\end{align}
and multiplying both sides by $\cos \left( \frac{(2m+1)\pi x}{2L} \right)$ and integrating over the domain $x \in [0,L]$ gives
\begin{align}
\sum_{n \ge 0} A_{n} \int_{0}^{L} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \cos \left( \frac{(2m+1)\pi x}{2L} \right) dx &= - \int_{0}^{L} u_{\text{stat}}(x) \cos \left( \frac{(2m+1)\pi x}{2L} \right) dx
\end{align}
which yields the coefficients (for $n = m$)
\begin{align}
A_{n} = - \frac{2}{L} \int_{0}^{L} u_{\text{stat}}(x) \cos \left( \frac{(2n+1)\pi x}{2L} \right) dx \tag 4
\end{align}
and hence after solving the above integrals, you have the solution to your PDE as a Fourier series.
Now, imagine after doing separation of variables that you hadn't yet solved the ODE in $T$ but had only solved the ODE in $X$, given by $X'' = - \omega^{2} X$. Then, as we know the solution will be a Fourier series, we can assume the solution $v(x,t)$ takes the general form
$$v(x,t) = \sum_{n \ge 0} X_{n}(x) T_{n}(t)$$
which is essentially what we have written at $(2)$ (note that our $X_{n}(x) = \cos \left( \frac{(2n+1)\pi x}{2L} \right)$ is the solutions $f_{n}(x)$. Similarly, $T_{n}(t) = a_{n}(t)$). Substituting into the PDE yields
\begin{align}
v_{tt} - c^{2} v_{xx} &= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) - c^{2} \sum_{n \ge 0} X''_{n}(x) T_{n}(t) \\
&= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) - c^{2} X''_{n}(x) T_{n}(t) \\
&= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) + c^{2} \omega^{2} X_{n}(x) T_{n}(t) \qquad \text{(as $X'' = - \omega^{2} X$)} \\
&= \sum_{n \ge 0} [T''_{n}(t) + c^{2} \omega^{2} T_{n}(t)]X_{n}(x) \\
&= 0 \qquad \text{(from the PDE)}
\end{align}
We know that $X_{n}(x) \ne 0$, hence we must have
$$T''_{n}(t) + c^{2} \omega^{2} T_{n}(t) = 0$$
We also need to use our initial conditions. Again, as $X_{n}(x) \ne 0$
\begin{align}
v_{t}(x,0) &= \sum_{n \ge 0} X_{n}(x) T'_{n}(0) \\
&= 0 \\
\implies T'_{n}(0) &= 0 \qquad \forall n
\end{align}
Notice that this is essentially the same condition we have at $(1)$. Applying the last condition
\begin{align}
v(x,0) &= \sum_{n \ge 0} X_{n}(x) T_{n}(0) \\
&= -u_{\text{stat}}(x)
\end{align}
which is essentially what we have written at $(3)$. So, just like we did after $(3)$, we multiply both sides by $X_{m}(x)$ and integrate over the domain, which gives
\begin{align}
\sum_{n \ge 0} T_{n}(0) \int_{0}^{L} X_{n}(x) X_{m}(x) dx &= -\int_{0}^{L} X_{m}(x) u_{\text{stat}}(x) dx
\end{align}
and using the result at $(4)$, we get that
$$T_{n}(0) = - \frac{2}{L} \int_{0}^{L} X_{n}(x) u_{\text{stat}}(x) dx$$
which is the other condition.
Best Answer
Fix an arbitrary value for $y$, say $y_0$. Then let $f(x) =u(x,y_0)$. You can immediately see that $f''+f=0$. This is very common ODE and most people just know that $\sin$ and $\cos$ are solutions, but if you're unhappy with that you can get there with $\exp(\omega x)$ solutions and some algebra.
Now we know that $f(x) = A \sin(x) + B \cos(x)$ for an arbitrary $y_0$. The only thing that can change when we change $y_0$ are the values of constants $A,B$.
This finally leads to conclusion $u(x,y) = A(y)\sin(x) + B(y)\cos(x)$ and the $A,B$ now functions of $y$ are determined by boundary conditions.