Certain groups of people have certain odors. I think genetics, cuisine, personal hygiene standards among that group, and other factors do affect this. This is not a bad thing, different human groups do look different, dress different, and occasionally smell different.
While in some flights you might be suffering to breathe, for the dominating group of the passengers there is nothing to smell and everything is ok.
Among some groups in certain countries, deodorants are not a thing, that also might affect your nose experience greatly. This group of people might be suffering in a flight with people who use too much deodorant, as it is annoying to them. It's all subjective to what's the nose is being used to.
Luck also plays a part in this, you might be unlucky enough to be seated next to a passenger who believes that deodorants cause cancer, in a flight departing from a city with a 50°C average temperature (122°F). Your ability to hold your gag reflex will be stress-tested, while the passengers two rows away are fine.
An example would be some flights heading to Indonesia, especially if it's a night flight, the plane will smell like the inside of a Vicks bottle due to the ointments they use. Personally, it bothers me, while for Indonesians and many others it is ok. I could list other examples, but someone might get offended.
As for food served, of course during the meal service the smell of food might be overwhelming, but that is usually temporary.
One more factor, if your seat is close to the lavatory then you are just waiting for it. If your seat is close to the galleys, this might also have a great odor additions, sometimes you might smell a burning smell when the crew are heating the meals.
I am talking out of experience as an ex-flight attendant for many years.