The two “Antennae” spiral galaxies started colliding a few hundred million years ago (a short timescale compared to galaxies lifespans). During the collision, the stars pass right on by each other but, because of gravity, enormous tidal forces eject streams of stars on the sides, causing the two-tailed shape of the system. The gas clouds inside each galaxy also get compressed, giving birth to thousands of new stars clusters. The galaxies nuclei will ultimately merge into a single galaxy. A similar event will happen to our Milky Way galaxy, when it will collide with Andromeda in several billion years.
Click image to zoom1