In the early stages of the formation of a solar system, dust in the nebula around a young star is attracted to each other because of their minute gravitational attraction to each other.
In the video below, accumulation of dust and gas creates a planet, probably a gas giant, that clears a swath of the solar nebula.