$u(x,t)=X(x)T(t)$ leads to the eigenvalue problem $$X''+\lambda X=0,\quad X(0)=0,\ X'(\pi)=0 \tag{1}$$ and the time problem $$T''+\lambda c^2 T=0.\tag{2}$$
The eigenvalues are $$\lambda_n=\left(\frac{(2n-1)}{2}\right)^2=\left(n-\frac{1}{2}\right)^2, \quad n=1,2,\dots$$ with associated eigenfunctions $$X_n(x)=\sin\left(\sqrt{\lambda_n}\,x\right), \quad n=1,2,\dots$$
Now that the eigenvalues are known, we can solve $(2)$:
$$
T_n(t)=a_n\cos(\sqrt{\lambda_n}\,c\,t)+b_n\sin(\sqrt{\lambda_n}\,c\,t), \quad n=1,2,\dots
$$
Thus, the solution to the PDE and BCs is
\begin{align}
u(x,t)&=\sum_{n=1}^\infty X_n(x)T_n(t)\\
&=\sum_{n=1}^\infty \sin\left(\sqrt{\lambda_n}\,x\right)\left[a_n\cos(\sqrt{\lambda_n}\,c\,t)+b_n\sin(\sqrt{\lambda_n}\,c\,t)\right].\tag{3}
\end{align}
Now is when you apply the initial conditions (you did so too soon before) in order to determine the coefficients $a_n$ and $b_n$:
$$
u(x,0)=\sum_{n=1}^\infty a_n\sin\left(\sqrt{\lambda_n}\,x\right)=x+\sin(x), \quad 0<x<\pi,
$$
This is just a Fourier sine series for the function $x+\sin x$ on $0<x<\pi$, so
$$a_n={2\over \pi}\int_0^\pi(x+\sin x)\sin(\sqrt{\lambda_n}\,x)\,dx, \quad n=1,2,\dots
$$
To apply other initial condition, differentiate $(3)$ with respect to $t$, then evaluate it at $t=0$, and set the result equal to $0$ (since $u_t(x,0)=0$ was given):
$$
u_t(x,0)=\sum_{n=1}^\infty \sqrt{\lambda_n}\,c\,b_n\sin\left(\sqrt{\lambda_n}\,x\right)=0, \quad 0<x<\pi,
$$
Again, this is just a Fourier sine series for the function $0$ on $0<x<\pi$, so
\begin{align}
\sqrt{\lambda_n}\,c\,b_n&={2\over \pi}\int_0^\pi 0\cdot\sin(\sqrt{\lambda_n}\,x)\,dx, \quad n=1,2,\dots\\
&=0
\end{align}
so $b_n=0$, $n=1,2,\dots$