Why do galaxies appear flat?
Objects in a galaxy with high tangential (sideways) rotational speed will remain spread out but those with lower sideways speed will come together along an equatorial band, forming an accretion disk.
Every galaxy or solar system starts off as an irregular or nearly globular cloud of gas, dust, and rocks but as mutual gravitational attraction causes the cloud to shrink and compress, some parts are moving sideways (tangentially) faster than other parts.
The parts that have less sideways motion will be drawn to the center of the rotating cloud more than the faster-sideways-moving parts, which will retain their distance from the center due to centrifugal effects. If the majority of the side-moving parts are along one band of rotation, that band will become the primary "equator" of the rotating system.
Those with a high sideways speed will be farthest from the core while those with lesser sideways speed will be closer in and would collide or merge with those objects nearer the equatorial band. Thus the cloud begins to flatten along one major axis and begins forming an accretion disk (shaped like a discus).