Why are there different types of galaxies?

Small galaxies tend to remain irregular. The age and size of a galaxy has a lot to do with its shape. Galaxies that have collided with others undergo major shape changes.

The following article should be helpful:
http://skyserver.sdss.org/dr1/en/astro/galaxies/galaxies.asp