Rocky planets form when small dust particles in a protoplanetary disk, the swirling cloud of gas and dust surrounding a young star, stick together and gradually grow larger. As the planets grow, they attract more and more material, eventually becoming large enough to form a rocky core. The core then accretes more material, including rocky debris, ice, and gas, to form a rocky planet.
M dwarfs are thought to be good candidates for hosting rocky planets because they have a smaller habitable zone, the range of distances from the star where liquid water can exist on the surface of a planet. This means that rocky planets orbiting M dwarfs are more likely to be located within the habitable zone and thus capable of supporting liquid water on their surfaces.
Additionally, M dwarfs emit less high-energy radiation than more massive stars, which can damage the atmospheres of planets and make them less hospitable for life. Therefore, rocky planets orbiting M dwarfs are more likely to retain their atmospheres and be potentially habitable.
However, it's important to note that the presence of rocky planets around M dwarfs is still a matter of active research, and astronomers are continuously studying these systems to better understand their characteristics and potential for habitability.