The Nebular theory or nebular hypothesis is still challenged by many. However, the solar nebular disk model (SNDM) is the accepted hypothesis as of today. Based on this theory, a new planetary system is formed when a new star is born, it produces a protoplanetary disk. this disk contains dust grains and would later on become a planet. The process would take millions of years!