Two separate things here: what you eat in camp, which is predictable and good, and what you eat in town, which is the more interesting half.
Food in camps and lodges
Better than it has any right to be, given where the kitchens are. Expect a cooked breakfast, a packed lunch or a buffet, and a proper dinner, usually three courses, often eaten communally at smaller camps. The style is broadly international with Tanzanian touches rather than fully local, because that's what most guests expect. Portions are generous and nobody goes hungry on a safari.
Dietary requirements
Vegetarian is routine. Vegan, gluten-free, nut allergies, halal and kosher are all workable in most camps, and they all need to be known at booking rather than at dinner, because supplies are driven or flown in. Be specific rather than general: 'no dairy' is more useful to a kitchen than 'I don't eat much dairy'.
What to eat in town
This is where it gets good. Ugali, a stiff maize staple eaten with your right hand alongside stew or greens. Nyama choma, grilled meat, usually goat, which is a social occasion as much as a meal. Chipsi mayai, a chip omelette, which sounds like a student dish and is excellent. Mishkaki, marinated grilled skewers from a street grill. On the coast and in Zanzibar the food changes completely: coconut, cardamom, cloves and tamarind, and the best seafood in the country. Ask about the Forodhani night market in Stone Town.
Drinking water
Don't drink from the tap. Camps and lodges provide filtered or bottled water and most now refill a bottle for you rather than handing out plastic, so bring a reusable one. Skip ice where you don't know the source, and be a bit careful with salads and peeled fruit from roadside stalls. In restaurants and camps, both are fine.
Coffee, beer and the rest
Tanzania grows excellent coffee, much of it on the slopes of Kilimanjaro, and a plantation visit near Moshi is a genuinely good afternoon. Local beers are cheap and perfectly decent. Tap water aside, the soft drinks, juices and bottled water are all easy to find.
The illness most people get, and how not to
A mild stomach upset, almost always from hands rather than food. Hand sanitiser before you eat, every time, including when you're eating a packed lunch on your knees in a vehicle. It's the single most effective thing in this article.
Ramadan on the coast
Zanzibar is predominantly Muslim, and during Ramadan many local restaurants close during daylight and eating or drinking in the street is inconsiderate. Hotels and tourist restaurants carry on serving as normal, so nobody goes hungry; it's a courtesy thing rather than a practical one. Check the dates when you plan, because they move each year.