Question: What is the law regarding food which was inadvertently brought into the restroom?
Answer: The restroom is a place where an evil spirit rests, as per the holy Zohar (Parashat Bereshit). Thus, when one enters a restroom, one mush wash one’s hands upon exiting. Even if one did not use the facilities, one must still wash one’s hands.
The Acharonim discuss whether or not the evil spirit that rests in the restroom rests on foods or beverages that were brought into the restroom. The Sefer Shalmei Tzibbur (page 18b) writes that the evil spirit that rests in the restroom rests only on things that are innately holy like one’s body (which is used to perform the Mitzvot and is thus holy); however, the evil spirit does not rest on foods and beverages since they are not innately holy. It is therefore permissible to bring them into the restroom.
Nevertheless, Hagaon Rabbeinu Chaim Palagi zt”l writes in his Responsa Lev Chaim (Chapter 66) that one may not bring food into the restroom and he proceeds to support his opinion with several proofs. Other great Poskim concur.
Maran Rabbeinu Ovadia Yosef zt”l discusses this topic (in his Responsa Yabia Omer, Volume 3, Chapter 1) and concludes that it is forbidden to bring food and drinks into the restroom. One who must bring food into the restroom, such as if one has a candy in his pocket and has nowhere to place it, may do so when it is covered inside one’s pocket and the like but not when it is uncovered.
If uncovered food was brought into the restroom, if it can be washed off with water three times, one should do so. For instance, if one’s child enters the restroom holding an apple, one should wash off the apple three times and only then proceed to eat it. However, it is a food that cannot be washed off, although there are those who rule leniently and allow eating the food as is, one who acts stringently and abstains from eating it is especially praiseworthy.
Summary: One should not bring food into the restroom. If a food was brought into the restroom, one should wash it off with water three times. If the food cannot be washed off, it is preferable to abstain from eating this food anymore.