The use of complex numbers when working with oscillations is often convenient. However, before we confidently exploit any such convenience, we have to be convinced that the process is mathematically legitimate. Let's use the current example as a concrete illustration.
For the physical system, we have two equations involving \(x_1,\ x_2\) that we have to solve simultaneously. For each of the equations, we can write down a copy of the equations that is identical, except writing \(y_1,\ y_2\) for the displacements instead, which is just a notational change. Now imagine writing the same equations yet again but with \(z_1=x_1+iy_1\) and correspondingly for \(z_2=x_2+iy_2\). Now we have equations involving complex numbers, but there is a direct mapping (both ways) between solutions for the real-valued \(x_1,\ x_2\) and the complex-valued \(z_1,\ z_2\). In treating the equation in real-variables as an equation in complex-variables, we will basically be solving the same equations in both the real-part and the imaginary-part. After obtaining the solution in complex-variables, the final step would be to take either the real-part or the imaginary-part of the solution, both of which should be solutions to the original problem in real-variables (but corresponding to different initial conditions).
The "convenience" of moving to complex numbers comes from the way sines and cosines become exponentials. We exploit the mathematical connection (de Moivre's theorem)