This is why most stars are formed as part of a star cluster rather than as individual isolated stars. In fact, the Sun's rotation period is about a month. Proto-stars manage to do this, according to the best recent observations and theory, by forming a jet of high speed particles outward along the rotation axis. Paradoxically, as the star is being formed by accretion of matter from an accretion disk, they are at the same time spraying matter outward at high speeds in a jet along the rotation axis. The physics of exactly how this happens is not fully understood, although there are several theories on how this occurs.
All theories rely on magnetic fields associated with the star or the disk.
We know that this happens, however, because we see the outflowing matter. This is the only option for the star to grow since the flow out the poles prevent accretion from these directions. The cloud core that forms at the center of a collapsing cloud can become quite luminous in the IR eventhough there are no nuclear reactions to sustain any luminosity. Basically for the conversion of gravitational potential energy to thermal energy. To understand this, we will use the virial theorem.