Stars are created from nebula and first appear on the main sequence. They stay on the main sequence for millions or billions of years. When a star begins to run out of fuel, it gets much bigger and colder and turns into a red giant. After this happens, the star is no longer on the main sequence. It does not spend so much time in its red giant phase.