The pi kinda comes from the conservation of energy statement.

(1/2)*SUM( m_i*(v_i)^2 ) = (1/2)*SUM( m_f*(v_f)^2 )

It's a sum of squares on either side of the equals sign. Any sum of squares is identical in from to a distance, squared.
The distance, squared in this case is the total energy, which is conserved, i.e. the same before and after any collision. In a sense (which I will explain multiple times), this defines a radius or diameter, which is equal for all states of masses and velocities.


If we look at 2 masses, then it's a sum of 2 squares on each side of the equation. This is like 2 right triangles with the same hypotenuse.
We can re-write it as follows to illustrate this (ignoring the factors of 1/2, which all cancel out):

( SQRT(m1_i)*v1_i )^2 + ( SQRT(m2_i)*v2_i )^2 = {hypotenuse}^2

AND

( SQRT(m1_f)*v1_f )^2 + ( SQRT(m2_f)*v2_f )^2 = {hypotenuse}^2

I'm using the square root of the mass to more clearly show that these are just a^2 + b^2 = c^2 equations.
Note that {hypotenuse}^2 is just an awkward way to write {Total Kinetic Energy}

Since these are equal to each other, the injection of setting them each equal to a third thing is trivial.
It just might help to see that these are kinda like 2 right triangles which share a hypotenuse.

Now, there is a fun thing about right triangles and circles. Draw a circle and then a diameter across that circle. Call the endpoints of that diameter A and B. Pick any point on the circle and call it point C. Construct the triangle ABC. It is always a right triangle with the angle at point C being the 90 degree angle.
I.e. the triangle ABC is always a right triangle whose hypotenuse is the diameter of the circle.


Perhaps you recall from grade school geometry that the center of a circle which circumscribes a right triangle is coincident with the midpoint of the hypotenuse.
Same thing.


The conservation of energy statement says that the initial conditions (the initial masses and velocities) imply a triangle, of sorts, by defining the length of the hypotenuse, which is the total kinetic energy. Since we're talking about idealized elastic collisions, we assert that the total kinetic energy after the collision is always the same as the total kinetic energy before the collision. Hence for any collision, the before and after conditions are described by the 2 sides of a triangle, which have a peculiar relation of sharing a hypotenuse.

***
note: I explain the same concept in multiple ways in this post. I am not covering how or why the pi comes out of the scenario in the way that it does. I am only showing why the choice of modeling this with a circle or with sines and cosines is sensible and not an arbitrary choice.