Some pets that seem very similar, like parrots, cockatiels and parakeets, have vastly different lifespans- parrots can live 50 years or more, cockatiels live about half as long and parakeets live about 5-8 years.
So why do animals have such different lifespans? On a base level it has to do with environment and body size, with colder environments slowing down metabolic rates and heartbeats and thereby allow animals to live longer.
But if you dig deeper you'll find that an animal's lifespan is also affected by the mechanics of their cell division- animals that have cells that can divide and are replaced when damaged live longer.
This TED talk by Dr. João Pedro de Magalhães breaks down all the reasons why animals have such vastly different lifespans, explaining that similar animals age at different rates due to genetic differences, like how their cells respond to threats. So while parakeets don't live long enough to become teenagers cockatoos live long enough to join AARP!