Some train or subway systems strictly prohibit any food or drink consumption. New York is one example. Others have exceptions. The Southeastern Pennsylvania Transportation Authority, for instance, allows noshing on light, small snacks as long as they're not made of cooked or prepared foods, which "don't mix with transit travel." You can also drink from a container with a sturdy, resealable lid, but you can't quench your thirst if your beverage is in an open container or can.
The reasons for these restrictions are pretty obvious. You may think your gyro, egg salad sandwich or steaming container of chicken curry is nothing but a delicious meal, but others may find the smell gross or stomach-churning. All the more so if you get jostled and the food tumbles onto them. Worse, if the train lurches and your Big Gulp dumps into your neighbor's lap. That person's not going to be very happy with you. In general, it's best to leave all food and drink at home. But if food is allowed, stick to items like water in a closed water bottle and non-messy, non-smelly snacks like grapes or an energy bar. (But only one that doesn't crumble.)