why are galaxies (and our solar system) disc shaped rather than spheres?
Gas clouds tend to fall into a plane, and hence form a disc shape, because the gas has angular momentum, and will tend to fall into a low energy configuration that can maintain angular momentum [1, 4]. Additionally, clouds of gas that make stars will tend to clump in the plane of the galaxy because this is a low energy configuration [2].
Most galaxies are disc shaped because the mass of the galaxy (mostly in the form of dark matter) is in a roughly spherical blob [1]. However, because dark matter doesn't interact with normal matter, the gas clouds that form stars fall into a disc shape [1][2]. These discs then pull more gas into their plane, producing more stars [2]. The solar system is also disc shaped because, like galaxies, it is formed by gas clouds [4]. The gas clouds in the solar system produce the stars in the disc shape of the galaxy [2]. The shape is maintained by the fact that the gas has angular momentum, and over time the gas will heat up and release that energy in the form of light [1]. The process will then repeat, causing the gas to fall into a lower energy configuration that can maintain angular momentum, which is a disc shape [1][2].