There are several factors that effect lifespan. The first being genetics, there are certain genetic issues, like genetic malo, that can drastically shorten their lifespan since their teeth grow in misaligned. All you can really do is trim them regularly and give pain meds, but eventually it will take a toll on the chin and the roots will grow too and since you can't trim the roots it's time to let the chin go. The only way to limit the chance of that is by going with a good breeder that doesn't breed chins with genetic issues.
Next is environment, a proper cage setup so they aren't at risk of a fall that could injure or kill them. A lot of people that keep chins as pets like the big tall cages, which are fine so long as you make sure everything is overlapped so they can't fall more then about a foot. An injury to the mouth or jaw can cause the teeth to become misaligned, causing malo. Being kept in a draft free place at the proper temp also plays a role, every time the chin overheats it does do damage to the organs and even brain. So although some people have had chins survive being kept in hotter then advised temps, it doesn't mean it's not doing damage. Similarly keeping or allow the temp to fall too low can also make the chin sick. As well as having chew toys that they actually will chew on. Having a variety of things is also a good idea since different things wear down the teeth differently, as well as keeps things interesting so they are encouraged to chew.
Next is proper diet of a good quality pellet only food and hay along with water is really all a chin needs. Treats are ok, but should be limited to a small percentage of their diet, and it's best to stick with healthy treats like certain dried herbs and flowers. Feeding things like fruits, vegetables, seeds, nuts, sugars (including honey), animal products (meat, eggs, hide, bone, dairy, etc), human junk food, and even grains (they can be gassy for some chins) as treats can all effect their health. The sugar can also cause tooth decay, and long term can cause organ damage, and the high fat content in seeds and nuts can cause fatty liver as well as obesity. Hay is an important part of the diet too, although some breeders disagree, but the fact is hay is required for proper digestion and chewing loose hay wears down molars much better then pellets. Yes pellets contain hay as well and may contain enough fiber for digestion for many chins, but loose strands of hay requires a lot more chewing to consume the same amount of nutrients, more chewing means more tooth wear. So even if your chin is eating their pellets just fine it's still important to provide loose hay the chin will actually eat. A variety of hay can also be benefial since different hay is chewed differently.
The last thing is just plain old luck, just like with any other living thing accidents and illness happen.
Not having a good start may or may not have lasting effects. For example if the overgrown teeth were simply from not getting a proper diet or things to chew on, but are otherwise properly aligned, trimming them and getting them to eat more hay and chew on toys can correct the problem. If the teeth have become misaligned though, just like with genetic malo, there is only treating the symptoms until you put them down. Getting improper foods like the ones I mentioned for a few years when young doesn't effect them as much as if given long term or as an adult. Kind of like how kids and eat all kinds of junk food but are still able to grow up to be healthy adults with a diet change. However if getting the wrong food effected how the teeth grew in that can be a problem.
With good genetics, proper care, proper diet, and luck chins can live on average 15-20 years.