The collision between the Andromeda Galaxy (M31) and the Milky Way Galaxy is indeed an interesting astronomical event. While it is true that objects in orbit around each other, like planets around the Sun, do not typically collide, galaxies are a different story.
The reason galaxies can collide while individual celestial bodies in a solar system do not is primarily due to the vast distances involved and the nature of their gravitational interactions. In our solar system, the distances between planets are vast compared to their sizes, so the chances of direct collisions are extremely low. Additionally, the gravitational forces between planets are relatively weak compared to their orbital velocities, allowing them to maintain stable orbits without colliding.
However, in the case of galaxy collisions, the distances between stars within galaxies are much larger compared to their sizes. The gravitational forces between galaxies can become significant and influence their motions. Over time, galaxies can approach each other, and their gravitational interactions cause them to distort each other's shapes and eventually merge or collide.
When the Andromeda Galaxy and the Milky Way Galaxy collide, it will be a slow and gradual process, taking place over millions of years. Although individual stars are relatively small compared to the vast distances between them, the gravitational interactions between galaxies can cause stars to be affected by each other's gravitational fields. During the collision, stars can be slung out of their original orbits or transferred to new orbits, leading to a reshaping of both galaxies.
While the probability of individual star collisions is low due to the vast distances between stars, the overall gravitational interaction between the two galaxies will result in significant changes to their structures. The two galaxies will eventually merge to form a new, larger galaxy. This process is a natural consequence of the dynamics of galaxies in the universe and provides astronomers with valuable insights into the evolution of galaxies over cosmic timescales.