How long a star can stay shining depends on how massive it is - but it probably works the opposite way to how you’d expect! Even though less massive stars have a lot less hydrogen fuel to burn*, they still last much longer than more massive stars. How does that work?
It’s all because more massive stars have stronger gravity, which pulls them in tighter and compresses the core more. This raises temperatures and pressures in the star’s core, causing the nuclear fusion which powers the star to happen faster - much faster. More massive stars have more fuel, then, but they’re burning it much, much faster than less massive stars are, and will run out sooner. It’s a bit like a spendthrift millionaire spending all his money in one go vs. a careful student carefully budgeting every penny she spends. The millionaire will go broke faster.
The Sun has a predicted lifetime of around 11 billion years or so (so it has another 6 or so billion years left), but very massive stars (~40 times the mass of the Sun) can only live for one million years! And the least massive stars - tiny, dim, red dwarf stars only 80 times more massive than Jupiter - can stay shining for over a trillion years! That’s far, far longer than the age of the Universe, which means the earliest red dwarfs to form after the Big Bang are still with us and will be around long after our Sun is gone - and after several new generations of Sun-like stars have been able to form, live their lives and die as well!