Cats have two kinds of fur: a short undercoat and the longer hairs, which are called the overcoat. Humans have bred some cats to get outrageously long and fluffy furs. They can get hairballs really bad.
When cats clean themselves with their tongues, some hair gets inside the cat. The more hair on the outside, the more hair on the inside. And hair can’t be digested. So the cat throws it up.