A $T$-periodic function $x(t)$ can (under some rather mild conditions) be written as a series of weighted complex exponentials with frequencies that are integer multiples of $\omega_0=2\pi/T$. This is the Fourier series of $x(t)$ as given in Eq. $(1)$ of your question. The weights in the sum of $(1)$ are the Fourier coefficients $X_n$, and they need to be computed from $x(t)$ via integration. That's Eq. $(2)$ in your question.
You can make this more plausible for yourself by plugging $(1)$ into $(2)$ and see what you get (I set $t_0=0$ without loss of generality):
$$X_n=\frac{1}{T}\int_0^T\left[\sum_{k=-\infty}^{\infty}X_ke^{jk\omega_0 t}\right]e^{-jn\omega_0 t}\;dt\tag{1}$$
Assuming uniform convergence of the Fourier series, we can exchange integration and summation in $(1)$ resulting in
$$X_n=\frac{1}{T}\sum_{k=-\infty}^{\infty}X_k\int_0^Te^{j\omega_0(k-n)t}\;dt\tag{2}$$
The integral in $(2)$ is given by
$$\int_0^Te^{j\omega_0(k-n)t}dt=
\begin{cases}\frac{1}{j\omega_0(k-n)}\left(e^{j2\pi (k-n)}-1\right)=0,&k\neq n\\\displaystyle
\int_0^Tdt=T,& k=n\end{cases}\tag{3}$$
where I used $\omega_0=2\pi/T$. Eq. $(3)$ can also be rewritten as
$$\int_0^Te^{j\omega_0(k-n)t}dt=T\delta[n-k]\tag{4}$$
where $\delta[n]$ is the unit impulse. With $(4)$, the expression in $(2)$ becomes
$$X_n=\frac{1}{T}\sum_{k=-\infty}^{\infty}X_kT\delta[n-k]=X_n\tag{5}$$
because the unit impulse eliminates all terms of the sum except for the term $k=n$. Eq. $(5)$ is what we wanted to show to make the two equations in your question more plausible, i.e. assuming that $x(t)$ can be written as a Fourier series, the coefficients $X_n$ must be computed as given by the second equation in your question.