1) 1 billion years after the big bang the first galaxies develop because of small unregularities of the distribution of matter after the big bang. This has been proved by satellite cobe finding little temperature
Copyright F.Hornischer - Credits to NASA.
variations of the cosmic background radiation reminding of big bang.
2) Because of matterconcentration of hydrogen in corresponding intensity suns catch fire with nuclear fusion in the center of it.
They consume their fuel in relatively short time of some million years and end in a supernova- explosion. With it develop heavy elements they throw into space.
3) From clouds of gas and dust with heavy elements by further rotation, collision and concentration of matter develop suns of the second generation. They can develop planets, on which life can develop.
4) Weak shining galaxies also develop which have too less matter to initiate nuclear fusion in stars.
5) Galaxies collide because of their gravitational attraction and so build big assembles of clusters and superclusters.
6) When galaxies do not collide for a long time, the suns of the 1st generation, then the suns of the 2nd and 3rd generation burn out over many billions of years. The galaxy shines more and more weakly until only burned out ashes and black holes will remain.