The sun was born about 4.6 billion years ago. Many scientists think the sun and the rest of the solar system formed from a giant, rotating cloud of gas and dust known as the solar nebula. As the nebula collapsed because of its gravity, it spun faster and flattened into a disk.