Galaxies are the largest single objects in the universe. Each one contains upwards of trillions of stars in a single gravitationally bound system. While the universe is extremely large, and many galaxies are very far apart, it is actually quite common for galaxies to group together in clusters. It's also common for them to collide with each other. The result is the creation of new galaxies.
Large galaxies, like the Milky Way and Andromeda Galaxy, came together as smaller objects collided and merged. Today, astronomers see smaller satellites orbiting nearby both the Milky Way and Andromeda. These "dwarf galaxies" have some of the characteristics of larger galaxies, but are on a much smaller scale and can be irregularly shaped. Some of the companions are being cannibalized by our galaxy.
The Milky Way's largest satellites are called the Large and Small Magellanic Clouds. They seem to be orbiting our galaxy in a billions-of-years-long orbit, and may not actually ever merge with the Milky Way.
Large-galaxy collisions do occur, which create huge new galaxies in the process. Often what happens is that two large spiral galaxies will merge, and due to the gravitational warping that precedes the collision, the galaxies will lose their spiral structure. Once the galaxies are merged, astronomers suspect that they form a new structure known as an elliptical galaxy. Occasionally, depending on the relative sizes of the merging galaxies, an irregular or peculiar galaxy is a result of the merger.
while galaxies themselves may merge, the process doesn't always hurt the stars they contain. This is because while galaxies do have stars and planets, there's a LOT of empty space, as well as giant clouds of gas and dust. However, colliding galaxies that do contain a large amount of gas enter a period of rapid star formation. It's usually much greater than the average rate of star formation in a non-colliding galaxy. Such a merged system is known as a starburst galaxy; aptly named for a large number of stars that are created in a short amount of time as a result of the collision.
Merger Between the Milky Way and Andromeda
The Milky Way and Andromeda are due to merge with each other in about 2 billion years from now. The galaxies will not collide in an explosive collision, they will instead merge over tens of millions of years. Due to the large distance between stars in a galaxy, it is unlikely that there will be any collisions at all. There will however be massive gravitational disruption which will severely disrupt not only the structure of the spiral arms but also the whole galaxy itself. Initially, the stars on the leading edges will be drawn together, elongating the galaxies somewhat. As the merger advances, the galaxies will appear to flow through each other. As they pass through each other, their velocities will slow and they will then enter into an orbit around each other as their momentum slows. The resultant merger will most likely take the form of a giant elliptical galaxy once the system has become stable.
Dark matter makes up 95% of the mass of a galaxy, mainly in the halo. During a galactic merger the dark matter interactions are not widely understood, however, it is suspected that dark matter from each galaxy passes through each other with little to no interaction. They are said to be weakly interacting.
It is suspected that each galaxy contains a supermassive black hole at its centre. During the galaxy merger, they will be drawn towards each other. As this happens the massive amount of energy they contain will be transferred to the surrounding stars, causing them to enter into slingshot style orbit. As the black holes get closer and closer they will emit gravitational waves which will transfer more orbit energy into the surrounding stars. Eventually, the two black holes will merge and form an active galactic nucleus or quasar.
The Sun is expected to be propelled towards the centre of the galaxy, possibly torn apart by the new supermassive black hole, or there is a chance that the Sun will be thrown out the galaxy altogether as it slingshots past the black hole.