What causes a nebula to collapse into a dense mass?
the answer is
Gravity. Irregularities in the density of the gas causes a net gravitational force