A nebula is a large cloud of gas and dust in space. When a nebula collapses under its own gravity, it forms a protostar. A protostar is a very young star that is still in the process of forming. It is surrounded by a disk of gas and dust, which will eventually form into planets.