Papaya and pineapple are commonly used to prevent hairballs, as they both contain papain and bromelain. The enzymes in these fruits help to break up hair by helping to digest the mucous and food surrounding the hair so that it does not cause blockage. Chinchillas cannot "cough up" hairballs like cats. Dried papaya and/or dried pineapple is given as a preventative treat for the health benefits rather than the taste, even though most chinchillas love it. That being said, too much of ANYTHING isn't good for chinchillas. Dried papaya/pineapple should be given in moderation.
While there is debate about whether or not chinchillas can even get hairballs, it is possible, as it is with any animal that has hair and grooms itself. (Even people are able to get hairballs!) Hairballs may be more likely in chinchillas who fur chew or in females who over-groom their young. For these animals, it may be better to give Petromalt or all-natural, fresh pineapple juice.