Stars contain a finite amount of fuel.
When a main sequence star exhausts its' hydrogen core, it enters the red giant phase. Thus, these structural changes take place in stars, due to a limited supply of fuel at the core. The coolest M type stars live the longest. They have low mass and as a result they achieve lower temperatures due to gravitational contraction. Thus, the rates of nuclear reactions are slow and their lifetimes at any stage of evolution are the longest.