Dogs and cats both have the instinct to eat grass when they are nauseous. But some cats and dogs eat it because they enjoy it, or to help with digestion. They're actually similar in that respect.
Cats really do just vomit for almost no reason, though. We've had foster cats vomit, solely because they are stressed in a new environment. A week or two later, they're fine. 😅