First galaxies were formed 3-4 billion years after the Big Bang. The age of the Milky Way’s oldest stars, the galaxy in which our Solar System is located, is estimated at 13,6+/- 0,8 billion years. The Milky Way’s Disc was formed between 6,5 to 10,1 billion years ago. How were galaxies formed?
Simply speaking, at one point, the matter which filled the universe began to gather together. The biggest densities are superclusters, which consist of galaxy clusters, and the galaxy clusters are made up by galaxies. All of these formations exist thanks to the gravity force (originating from matter and dark matter). These formations aren’t permanent, because cosmos is expanding, galaxies are colliding with one another creating new structures. This is very complicated processes but an easy experiment described by Tomasz Rożek in his book ,,Cosmos’’ allows to illustrate this state of affairs in a simple way.
We poured several dozen drops of oil into a glass bowl filled with water (the water is the universe, the drops of oil are galaxies). When we’ve started mixing it, we noticed that single drops started joining with each other- these bigger were attacking these smaller.