Scientists believe that clumps of gas joined together to form young galaxies called protogalaxies. These protogalaxies developed in different ways. Some had huge clumps of gas at the center, which formed massive explosions. Many massive explosions forced the left over gas out of the galaxy. So, only the stars formed from the gas remained. Protogalaxies formed in this manner become elliptical galaxies.
Sometimes, a protogalaxy will contain only small clumps of gas. Since its center will be smaller, there will be fewer massive explosions. Most of the gas is retained along with the stars that have formed, and the galaxy becomes a spiral galaxy.
irregular galaxies are probably protogalaxies in which explosions are still going on.