The Lord God took the man and put him in the Garden of Eden to work it and take care of it. And the Lord God commanded the man, "You are free to eat from any tree in the garden; but you must not eat from the tree of the knowledge of Good and Evil, for when you eat it, you will surely die." (Genesis 2:15)
So it is said in the Bible, a basic story element: the temptation of mankind and the resulting expulsion from the Garden of Eden. From this point, this element and the imagry of food as a means of temptation has been used in a number of subsequent works, especially within the speculative fiction realm. With this imagery, there is the theme of utopia as something to be gained or lost with the consumption of the food, and is either an element that the protagonist is tempted away from, or something that proves to be an obstacle in the pursuit of utopia.
According to Brave New Worlds: The Oxford Dictionary of Science Fiction, the notion of 'Utopia' comes from Sir Thomas More, although as the Bible demonstrates, it is a concept that certainly predates More's musings on the subject. The Greeks, through their epic story the Odyssey, used the imagery in a couple of instances as Odysseus travelled home from Troy: The encounter with the Lotus Eaters, where three of Odysseus's men ate the Lotus, became addicted and thought nothing of returning home, but their later encounter with Circe on the island of Aeaea is one in which these themes really come out:
"They called her and she came down, unfastened the door, and bade them enter. They, thinking no evil, followed her, all except Eurylochus, who suspected mischief and staid outside. When she had got them into her house, she set them upon benches and seats and mixed them in a mess with cheese, honey, meal and Pramnian wine, but she drugged it with wicked poisons to make them forget their homes, and when they had drunk she turned them into pigs by a stroke of her wand, and shut them up in her pig styes."
In these instances, the men who came under the various substances and spells found that they were pulled away from their journey - the temptation theme at its best, and introduces the idea of going home as a form of Utopia for those far away. Certainly, the soldiers who fought at Troy for ten years would liken their homes to something special, perfect, as a means to get them through the conflict. This would be for a couple of reasons: they were fighting a battle on the part of their home nation, something worth protecting and dying for, and had plenty of motives to return. This makes the theme of their temptation even more important in the larger view of the storyline: they have an incredible amount to lose in their return, and their failure to adhere to their goal demonstrates their weakness in character and desire to return home, intentional or not. Like in the Bible, there is a central moral to the story that the righteous and those who have strong moral fiber will see their goal to the end - the adventures of Odysseus' crew, and later, Adam and Eve, demonstrate this to a fine point.
While Ancient stories have certainly used this element numerous times, a number of modern stories also take on similar imagery, with similar morals. The Grimms Fairy Tales include a story that is no doubt familiar to many: Hansel and Gretel, which sees the two children abandoned to die in the middle of the forest by their evil stepmother. As they attempt to find their way home, they come across a white bird, which delights them and leads them to a house made of bread and sugar. Overcome with hunger, they eat at the house and are invited in by the old woman who lives there, who intends to snare and eat them. Gretel tricks the witch into the oven in her place and escapes home. Once again, the perils of moving away from one's goals, in this instance, being tempted by food while attempting to return home, is used, although in this instance, it is children who are swayed, rather than men.
Coraline is another story that comes to mind, when looking at more recent works. Neil Gaiman's tale sees the young girl Coraline Jones in an unhappy existence with her parents, and upon her discovery of an alternate world, she is enticed with the idea of a better set of alternative parents, who feed her (which brings to mind this imagery of a table full of food being a vehicle for temptation) and show her a life that is very different, but odd. Over the course of the story, Coraline realizes that this existence and its inhabitants have their own motives, and not motives that will benefit her, and the main character struggle is in her fight to return her parents and herself to their proper existence. This is the main part of the appeal of the story, where Coraline must not only determine her true place, but also the value of home. Where other stories have take the notion of home as a set utopian value, Coraline must first determine what her utopia is: home, for all of its flaws, is the place where she is truly loved, and where she belongs.
Similar themes are brought up in Pan's Labyrinth, where the image of a feast tempts away Olivia after she begins her own journey after meeting the Faun in the Labyrinth behind the Spanish outpost. At this point in the story, she has already completed one of the tasks set before her - recovering the key, in her journey towards returning to her mythic home, where she is supposed to be a long lost princess, on a quest to return to her home. When she brings the key to the lair of the Pale Man to retrieve the knife, and overcome with hunger, she eats from the table, and is chased out by the Pale Man, who has eaten other children before her. Once again, the theme of temptation swaying the traveler is brought along, and it harkens back a bit to the Adam and Eve story, where the girl is tempted away (as in Coraline as well) from the true path by a distraction, in this instance, a meal.
On the science fiction side of the house, Paolo Bacigalupi's novel The Windup Girl features in some similar ideas, if on a much greater scale than just the character's actions, but figures far more into the background story in the world that Bachagalupi presents. Agricultural firms have wrecked the world through their actions, attempting to turn their food into a better product, and unwittingly unleash plagues into the world, causing economic collapse and famine across the world. In the pursuit of a Utopia, they have created the opposite, a dystopia-style world where they have strayed from an arguably more righteous path: the preservation of the species.
In all instances, the idea of food is used to sway the protagonist or other characters from their own personal utopias, whether that's their home or the creation of a perfect world, where they are loved, which in and of itself reveals a couple of things: the definition of a Utopia isn't necessarily a paradise that is populated by their desires, but by a single concept: love, either the love of one's parents or one's subjects/compatriots, for their simple existence. In Coraline, Olivia and Hansel/Gretel's case, it's the love of their parents, in Odysseus's, it's his family, and in the instance of the corporations in the Windup Girl, it's the people that they feed.
Their quest for a personal utopia demonstrates that a utopia is something that can be revoked, as Adam and Eve both found, but that one of the basic motivations for one's existence is to seek such a concept - God's placement of a flaming sword at the entrance of Eden demonstrates the struggle to achieve such a goal - otherwise, it stands to reason that the Garden could simply be taken from existence, where the temptation and goal would be gone forever, and thus, become nothing to seek. God did not do this, but he left the Garden in place. Food seems to be the constant in most of these stories (and I'm sure that there's numerous other examples - these were the ones that were immediately familiar to me), because it is, in itself, a symbolic measure - food is something that sustains, but something that rots with time, and is, in effect, a temporary joy when compared to the character's ultimate goal. In all instances, the characters are temped because of their circumstances, where they are desperate to continue onwards. In a way, the scales are tipped against the characters.
When looking at a number of these stories, it's generally the woman who instigates this sort of fall, most likely as a reference to the biblical story - the Greeks had no issue with the men instigating their own downfall, while Gretel was the one who saved her brother. Coraline and Olivia had their own weaknesses and thus were hampered by them, as well as Eve, way back when. There are arguments along this line that this is sexist in all different ways, and while yes, it certainly is when you look at it in one way, but it can also be looked at as opportunity, where the women overcome their newfound trouble and emerge victorious - Coraline recovers her hapless parents, and Olivia ends up in her mythic home (of course, she dies in the process). If anything, the men of these stories come out pretty poorly, and aren't the ones that the story is about - this proves to be an excellent change for strong female protagonists in a story.
This leads to another aspect of this argument, which was the existence of the Tree of Knowledge in the first place, as a sort of test for the characters on their journey. In each case, the characters fail this test, and their quest towards Utopia is jeopardized: Odysseus's soldiers are almost foiled from their return home (although they are killed off in other ways), various children are almost eaten, and so forth. Yet, in their failure, they find new opportunity to prove their character and better themselves by learning from their mistakes and regaining their morals to reach home. Where they fail in each case, this too happens in almost each case.
This impacts story in huge ways - it provides motivation for characters in ways that translate into real life, and provides a way for characters to grow and change with the issues that they face along their respective paths in life. In a number of ways, this specific imagery is used to hearken back to the bible, because it's very basic imagery. The character is hungry, but shouldn't stop - that is certainly something that's fairly easy to relate to, and works for all the reasons outlined above.
The obvious answer to all of this is that it's a moral story presented for the characters as a means to teach a simple and complex lesson to the reader: temptation can often lead to problems for the protagonist, and that their weakness in character must be compensated for by continued hardship and peril in their journey towards their utopia.