Galaxy Formation 
Observations by Hubble Space Telescope and ground-based instruments show that the first galaxies took shape as little as one billion years after the Big Bang, which probably took place about 13 billion to 14 billion years ago.
There are two leading theories to explain how the first galaxies formed. The truth may involve a bit of both ideas.
One says that galaxies were born when vast clouds of gas and dust collapsed under their own gravitational pull, allowing stars to form.
The other, which has gained strength in recent years, says the young universe contained many small "lumps" of matter, which clumped together to form galaxies. Hubble Space Telescope has photographed many such lumps, which may be the precursors to modern galaxies. According to this theory, most of the early large galaxies were spirals. But over time, many spirals merged to form ellipticals.
The galaxy-formation process has not stopped. Our universe continues to evolve. Small galaxies are frequently gobbled up by larger ones. The Milky Way may contain the remains of several smaller galaxies that it has swallowed during its long lifetime. The Milky Way is digesting at least two small galaxies even now, and may pull in others over the next few billion years.
Galaxy mergers happen fairly often. A large portion of the bright galaxies that we see today may have formed from the mergers of two or more smaller galaxies.
Mergers are common because the universe is crowded on the galactic distance scale. The disk of the Milky Way, for example, spans about 100,000 light-years; the nearest major galaxy, the great spiral in Andromeda, which is a little bigger than the Milky Way, is about 2.5 million light-years away. That means the distance between these two galaxies is only about 25 times greater than the sizes of the galaxies themselves. That doesn't leave a lot of "elbow room" for galaxies.
Galaxies are very massive, too, so their gravity is strong. When you crowd them together, the attraction can be so strong that two galaxies latch on to each other and don't let go. Eventually they merge, forming a single giant city of stars.
The largest galaxies are giant ellipticals. They look like eggs or footballs. They can be 10 times the Milky Way's size and contain more than a trillion stars. Such galaxies probably formed when two or more spirals, like the Milky Way, merged to form a single galaxy.
One bit of evidence supporting the merger theory is the large number of ellipticals in dense clusters of galaxies, where mergers must be common. Two giant ellipticals dominate the center of the densely packed Coma Cluster, for example. And the heart of the Virgo cluster contains three giant ellipticals that each span almost one million light-years.
Mergers can take anywhere from a few hundred million to a few billion years to complete. They can trigger intense bursts of new star formation, and even create gigantic black holes.
Stars Remain Unscathed
Galactic collisions rarely produce head-on wrecks between individual stars. Even when two galaxies ram together, the distance between stars is enormous. Yet stars can suffer ill effects from the collisions. They can be thrown into new orbits, or even thrown clear of their parent galaxies into intergalactic space.
While galactic collisions rarely destroy stars, they often create them. As vast clouds of gas and dust in merging galaxies slam together, they can create thousands or even millions of new stars.