My take as speculation:
1) There is no "rule". If there was it would most likely be listed with all the other rules and requirements when you buy a ticket or enumerated along with all the other things that have to be stowed in the pre-take-off announcement.
2) If the OP was in coach on a full flight, the FA maybe was looking for overhead bin space to stow a carry-on and found a soft small bag and asked "who's is this and what is in it". A common occurrence IME. Upon hearing "food", the FA had their excuse to pull it, albeit the reasoning was bogus, IMO.
3) Alternatively to #2, whatever food was in there "aromatically leaked" and either a nearby pax blew the whistle or the FA themselves detected it.
My bet is on #2.