Proto-nebula, probably the remains of a larger star that died. Then nebula, caused by the gravity of near by stars. This collapses into a proto-star (spinning disk). This causes a massive explosion, most of the matter is sucked back into the sun. Whats left became our planets.
The early sun was a blue giant for about 100 million years or so. It eventually cooled into a white star. After about 3 billion years it became a yellow dwarf. Which is what it currently is at presant.
Now this sun is heating up as it burns up its hydrogen fuel and left with only helium and it will gradually expand into an orange star that will redden and swell to become a red giant (probably not for about another 3-6 billion years). Then as it burns off its helium fuel it'll shrink down to a red dwarf star, not much bigger than the earth itself. If the sun is lucky it will instead flare into a white dwarf, not much of a good thing for earth, but white dwarfs will burn on for possibly a trillion years. If the sun instead becomes a red dwarf it will slowly cool to a brown dwarf and then a black dwarf. The total life span of the sun is about 10 billion years - if it turns into a red dwarf.