1) Stars spew out dust and gas as they die, which collects into clouds in the interstellar medium.
2) In these clouds, dust and gas coalesces due to gravity to form new stars and planetary systems, with protoplanetary disks forming around young stars.
3) The solar system formed from a protoplanetary disk around the sun over billions of years, with the planets forming and evolving into their current configurations as explained by the nebular hypothesis.