Hi!
Stars are formed when they condense from nebular material, that is clouds of gas. They collapse because of their own gravity, and become hot. When they are hot enough (millions of degrees Celsius) they start to have nuclear reactions in the core. This is about the stage the Sun is at -- eventually it will run out of nuclear fuel, the Sun's outer layer will expand outwards turning it into a Red giant, and eventually all that will be left will be a cooling core, known as a white dwarf.