How did the accretion of galaxies and stars occur?
Initially, electrostatic attraction. Ultimately, gravitational attractive forces.
If we start with inter-stellar gases then the initial accretion must be the clumping together of individual atoms and molecules by molecular attractive forces. As these become larger they begin to have a discernible gravitational force proportional to their mass.
The mutual gravitational attraction of these and other forming gas clusters brings more and more of them together. The size of a star depends on the amount of raw material available in a region. The size of a galaxy depends on the proximity of the stars being formed.