The formation of a solar nebula, and subsequently a planetary system, is often triggered by the presence of a nearby massive stars. These massive stars experience supernovae explosions which send shock waves and compress nearby interstellar gas and dust. This compression leads to the formation of dense regions called molecular clouds, which are colder and more compact regions within interstellar space. Within these molecular clouds, gravitational forces begin to take over. If a region becomes dense enough, it can reach a critical point where the gravitational forces overcome the internal pressures. This leads to the collapse of the molecular cloud, initiating the process of star formation.
At the center of the collapsing cloud, a massive core forms, which will eventually become the central star of the system. Surrounding this central core is a rotating disk of leftover material known as the protoplanetary disk, or solar nebula. This disk is composed of gas, dust, and smaller solid particles. Over time, the processes within the protoplanetary disk give rise to the formation of planets, moons, and other celestial bodies, resulting in the creation of a planetary system.