How do cats get sick from cat food?



My cat gets sick from cat food some times. she throws up and lies down and eats grass. we switched her food and she stopped for a while. whats going on and why?????????? help me out!