Gas clouds that astronomers talk about consist of hydrogen and helium, the most abundant elements in the universe. These gas clouds can collapse under their own gravity and form a star. The inside of that star is so dense that hydrogen is fused into helium (in Sun-like stars) and into heavier elements such as carbon, oxygen, and eventually iron (in more massive stars).
When a massive star explodes at the end of its life as a supernova, even heavier elements form, and these spread out to eventually mingle with another gas cloud.
Hydrogen and oxygen can now combine into H2O; carbon and oxygen form CO2. Carbon, hydrogen, and other light elements form organic molecules, often referred to by astronomers as the building blocks of life. The ingredients form molecular clouds. Heavier elements like iron and silicon combine with oxygen to form minerals, and we refer to these tiny mineral grains as dust. Water ice or organic molecules can then stick to these dust particles.
Our solar system formed from a gas and dust cloud. While gas giants like Jupiter and Saturn are mostly hydrogen and helium, it took a lot of dust and whatever stuck to it to form rocky planets like Earth and Mars.
University of Stirling