As the planets formed the other matter in the solar nebula moved closer to the center, which became so dense and hot that hydrogen atoms began to fuse, to form helium. This released a huge amount of energy , which created enough outward pressure to balance the inward pull of gravity. After all this, the gas stopped collapsing and the sun was born.
Planetesimals are small celestial bodies that are formed from dust, rock, and other materials. Planetesimals can range in size anywhere from several meters to hundreds of kilometers.
when a planetary system is forming, there is a protoplanetary disk with materials from the nebulae from which the system came. This material is gradually pulled together by gravity to form small chunks. These chunks grow until they form planetesimals. Some of these chunks will later become planets
Planets form by, the force of gravity pulling together materials from the nebula, and those materials will grow as they orbit the sun, until they grow large enough and become planets