Small galaxies are frequently gobbled up by larger ones. Our own galaxy, the Milky Way, may contain the remains of several smaller galaxies that it has swallowed during its long lifetime. The Milky Way is digesting a small galaxy right 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, at least on the galactic distance scale.
That means the distance between these two galaxies is only about 20 times greater than the sizes of the galaxies themselves. 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.