First, a cloud of gas and dust are disturbed by the gravity of a nearby explosion. The disturbance causes clumps to form and draw gas inwards. The clumps start to collapse, the collapsing clumps begin to rotate and flatten into a disk of gas and dust. The disk rotates faster and faster pulling more material inwards, creating a hot dense core called a protostar. When the protostar becomes hot enough, hydrogen atoms begin to fuse, producing helium and energy.
Hopefully you have learned a lot about stars.