Finding the equivalent spring and solving the 1DOF equation is a shortcut to a more complex problem. So if you want to know about the more complex approach, then read on.
The problem is a special case of the general problem with two springs and two masses. The special case is when one of the masses is zero.
So the general problem has mass $m_1$ (the black dot) in the end of $k_1$ and $m_2$ (the gray box) in the end of $k_2$.

The equations of motion in terms of the positions of the masses $x_1$ and $x_2$ are as follows:
$$ \begin{aligned}
m_1 \ddot{x}_1 & = -k_1 x_1 + k_2 (x_2-x_1) \\
m_2 \ddot{x}_2 & = -k_2 (x_2-x_1)
\end{aligned} \tag{1}$$
Note the op uses $x_1$ and $x_2$ for spring extensions, and I am using these variables as mass positions. The extension of the first spring equals $x_1$, but the extension of the second springs equals $x_2-x_1$.
Any solution of the above is the superposition of the two natural frequency responses of the system. And there is a standard way to solve this problem using eigenvalues and eigenvectors and some linear algebra.
But in this case $m_1=0$ which makes the above equations equal to
$$ \begin{aligned}
0 & = -k_1 x_1 + k_2 (x_2-x_1) \\
m_2 \ddot{x}_2 & = -k_2 (x_2-x_1)
\end{aligned} \tag{2}$$
which makes them a DAE system (differential algebraic equations). Here you solve the first equation for $x_1$ and plug it into the second equation.
$$ m_2 \ddot{x}_2 = -\underbrace{\left( \frac{k_1 k_2}{k_1 + k_2} \right)}_{k_{\rm eq}} x_2 \tag{3} $$
So the solution is the same as solving a 1DOF differential equation in terms of $x_2$ using the equivalent spring $k_{\rm eq}$. Note that for each solution of $x_2$ the value of $x_1$ is found from (2) with $$x_1 = \frac{k_2}{k_1+k_2} x_2 \tag{4}$$
Appendix I
The two natural frequencies of the general system are
$$ \begin{aligned}
\omega_1^2 & = \frac{ \left( \tfrac{k_1+k_2}{m_1}+\tfrac{k_2}{m_2}\right)
- \sqrt{ \left( \tfrac{k_1+k_2}{m_1}+\tfrac{k_2}{m_2}\right)^2 - \tfrac{4 k_1 k_2}{m_1 m_2}}}{2} \\
\omega_2^2 & = \frac{ \left( \tfrac{k_1+k_2}{m_1}+\tfrac{k_2}{m_2}\right)
+ \sqrt{ \left( \tfrac{k_1+k_2}{m_1}+\tfrac{k_2}{m_2}\right)^2 - \tfrac{4 k_1 k_2}{m_1 m_2}}}{2}
\end{aligned} \tag{5} $$
For the case when $m_1=0$ then the above becomes
$$ \begin{aligned}
\omega_1^2 & = \pm \infty \\
\omega_2^2 & = \frac{\tfrac{k_1 k_2}{k_1+k_2}}{m_2}
\end{aligned} \tag{6}$$
Appendix II
The equations of motion in terms of spring extensions $x_1$ and $x_2$ are
$$ \begin{aligned}
m_1 \ddot{x}_1 & = -k_1 x_1 - k_2 x_2 \\
m_1 \ddot{x}_1 + m_2 \ddot{x}_2 & = -k_2 x_2
\end{aligned} \tag{7}$$
with the solution for $m_1=0$ as $$x_1 = \frac{k_2}{k_1} x_2$$ and
$$ \ddot{x}_1+ \ddot{x}_2 = - \frac{k_2}{m_2} x_2 $$
but since $x_1$ is a function of $x_2$ only, then $\ddot{x}_2 = \tfrac{k_2}{k_1} \ddot{x}_1$ and the 1DOF equation becomes
$$ \left( 1 + \frac{k_2}{k_1} \right) \ddot{x}_2 = - \frac{k_2}{m_2} x_2 $$
which becomes equivalent to (3) when solved for $\ddot{x}_2$.