It's not about the individual living forever, you just need to pass on your genes. Increasing single-organism longevity will sooner or later have diminishing returns because there's always an external mortality rate (i.e. you get eaten by a shark).
Mutations are random and continuous. Most of them aren't useful, many are harmful. However, to lose those harmful mutations from the gene pool by natural selection takes some time, and new mutations are continuously introduced, so there is a mutation-selection balance.
If a mutation occurs which only starts to affect your chances of continued survival after you've already lived for a long time, this is slower to be removed from the gene pool since you've probably already passed on genes and/or died from other causes by then. So the selection pressure against such mutations would be lower.
Further, mutations may have more than one effect. If a mutation were beneficial early in life and harmful later in life, there may be a selection pressure favoring that mutation. Thus senescence appears not because it is beneficial but because it is not selected against strongly enough to be removed.
This forms something of a feedback loop, since once you get some mutations which cause decay with age, these make it even less likely that you will live to be old.
There are many other ideas (
https://en.wikipedia.org/wiki/Evolution_of_ageing)