Most cats groom themselves regularly. They are very neat and particular about cleanliness. There are occasions when a cat ingests too much hair while grooming, or when the digestive tract is more sensitive, and it initiates the ugly involuntary retching and gaging that brings up that tubular mess of hair.
Hairballs are not uncommon, but they can signal a more serious issue that requires your veterinarian.