How do disk-shaped galaxies then form at the sites of spherical galactic halos? Do the halo stars start orbiting or just sit in place? Phys.org's Astronomers detect large amounts of oxygen in ancient star's atmosphere mentions

&quot;Stars like J0815+4729 are referred to as halo stars,&quot; explained UC San Diego astrophysicist Adam Burgasser, a co-author of the study. &quot;This is due to their roughly spherical distribution around the Milky Way, as opposed to the more familiar flat disk of younger stars that include the Sun.&quot;

Wikipedia's Formation of galactic halos says

The formation of stellar halos occurs naturally in a cold dark matter model of the universe in which the evolution of systems such as halos occurs from the bottom-up, meaning the large scale structure of galaxies is formed starting with small objects. Halos, which are composed of both baryonic and dark matter, form by merging with each other. Evidence suggests that the formation of galactic halos may also be due to the effects of increased gravity and the presence of primordial black holes. The gas from halo mergers goes toward the formation of the central galactic components, while stars and dark matter remain in the galactic halo.
On the other hand, the halo of the Milky Way Galaxy is thought to derive from the Gaia Sausage.

&quot;Halos... form by merging with each other&quot; isn't profoundly instructive, but I'm guessing it means that there are small inhomogeneities and the coalesce into larger ones without a lot of rotation being involved (thus the spherical shapes). I suppose the part about the Gaia Sausage means that the Milky way is not a good example of a disk-shaped galaxy forming at a spherical halo.
Question(s):

But how do disk-shaped galaxies then form at the sites of the spherical halos?
Do stars in the halo just sit there without rotating, or perhaps slowly accelerate towards the gravitational center?
The key to understanding this is that dark matter and, effectively, stars are collisionless, whereas gas is collisional.

Structure formation

As written in the second quote, structure forms in a hierarchical, bottom-up fashion. That is, small halos of gas and dark matter (DM) collapse first on small scales, and these halos then merge to form larger halos. This is in contrast to what was previously thought, namely that galaxies formed in a so-called monolithic collapse from a huge, primordial cloud (Eggen, Lynden-Bell &amp; Sandage 1962).

On the very smallest scales, thermal motion will tend to wash out structure and prevent collapse. The first structures to collapse are thought to have masses of some $10^5\,M_\odot$, but the exact value depends on your assumed initial conditions. During the collapse, these clouds then fragment to form stars.

Collisionless matter

Because DM is collisionless, it is difficult for it to "relax", i.e. settle down into a dense, "virialized" structure: A DM particle falling into the combined potential of gas and DM will tend to go right through through the center. However, because the potential isn't static, but contracts, the particle doesn't go as far to the other side, and eventually a DM halo will relax (thanks to Peter Erwin for making me aware that I underestimated this effect).

The same is effectively true for stars: Of course, stars can smash together, but the chance of two stars getting close enough for this to happen is minuscule because they're so far apart.

Collisional matter

The story is different for gas: The collapse is dominated by DM (because there's much more), but when gas gets dense enough, hydroforces become significant. The atoms will collide, electrons are excited, de-excite, and emit photons, removing energy from the system. In other words, gas can cool.

Formation of the disk

This causes the gas to basically smash together in the bottom of the potential well, and eventually settle down into the center of the halo. Although there are ways to shed itself of some of the initial angular momentum, it will usually maintain enough to form a rotationally supported disk, with centrifugal forces impeding the collapse in the plane of the rotation.

The halo

The first population of stars are formed before the disk has settled, and so have random motions around in the potential. The massive stars quickly die, leaving the longer-living, dispersion-dominated (as opposed to rotation-dominated) population of relatively low-mass, metal-poor stars, known as Population II stars.

That is, the stars in the halo do not just "sit there", but orbit the galactic center like the disk stars. However, the orbits are quite unordered.