Google the Eris simulation for a video of spiral galaxy formation.
-
all the stars planets asteroids - in fact everything in our galaxy was formed from a truly gargantuan cloud of spinning hot gas left over from the Big Bang, and in all the places where the gas was densest and hottest,and where the gas was spinning fastest, a star and planets formed. This took place over billions of years.
-
From the collision of smaller gallaxies.
-
first there was a really big mass of gas and rocks...then they pulled together by gravity.