Space is full of clouds of dust and gases, known as nebulae.
The dust and gases in nebulae have a certain mass, and we know, from Newton’s law of gravity, that any object with mass attracts other objects to it.
The dust and gases are gradually pulled toward each other by the force of gravity.
In this early stage of creation, a star is called a protostar.
The protostar doesn’t look anything like what we think of as a star. It is too cold and loosely packed to give off any light.
Technically, it has been born, but its matter must first collapse under its own gravity and begin thermonuclear fusion before we would recognize it as a fully realized star.
Astronomers know about protostars because they radiate radio and infrared waves.