The story of "Young Goodman Brown," by Nathaniel Hawthorne is a clear moral allegory.
It is felt that the story was written in reaction to the Salem Witch Trials of 1692. One of Hawthorne's ancestors was a judge at the trials—where a pious community became slaves to false allegations and superstition. It was an embarrassing heritage for Hawthorne.
Many of his writings deal with themes that delve into "...evil actions of humans and the idea of original sin." Evil actions by humans is central to the allegory. It's important to understand that an allegory in literature is a story of symbolic importance:
...that serves as a disguised representation for meanings other than those indicated on the surface.
In other words, on the surface, the story being read has a plot, characters, conflict and a resolution. It is a story in its own right. However, in an allegory, elements of the tale have a deeper meaning, symbolizing "moral qualities," etc., with the purpose to relay an additional "hidden" message to the reader.
In "Young Goodman Brown," our main character is a member of a devoutly religious society. (Though not named as Puritans, the parallel is clear.) One day the virtuous Brown leaves his newly-wed wife to travel for some unknown reason into the forest. (The Puritans believed the Devil lived in the forest.)
On his trip, Brown meets an old man who is the Devil in disguise, who secretly wants to get Brown to reject his faith. As they walk, Brown senses evil and tries to distance himself. He remembers his ancestors—holy men—whose memory he calls on to help him. The Devil tells him that they were "in league" with him. Strong religious members of his community pass by, going to a Black Mass. Brown is horrified as his eyes are opened to the wickedness lurking within those closest to him—who he has looked to for inspiration. At last, as he looks on, his wife Faith is brought forth and both are called to join the Devil. Brown tries to yell encouragement to his wife, but in an instant, everyone disappears—and Brown is unsure if it was at all real or just a dream. Now believing that he is surrounded by sinners, his awakening drives Brown to believe there is no good in the word. He rejects his faith and dies a lonely, embittered old man.
The situation that Hawthorne presents here is Brown's inability to accept the fragile nature of the human condition, and the truth that all people are sinful, even Brown himself. However, his expectations of those of the past and those in his life now, do not allow Brown to accept sinfulness as a human trait (even though it is biblically presented: all men are sinners); and, too, he has no compassion. Expecting perfection is impossible; this is something Brown does not grasp, and it does not allow him to forgive others for their shortcomings.
Hawthorne reminds us of the lack of compassion found in the Puritan society—that the promise of the smallest sins was punishment, and no forgiveness was offered, though this was the central message of the New Testament in the person of Christ. The allegorical message here is that all of us are in the same "boat." We all make mistakes: we cannot help it.
Looking to Goodman Brown's fate, we should see that if we can't allow others to be imperfect, we will be lonely, hypocritical and miserable people. We must be realistic and accepting of others who follow a different path—for even then, we can still hold on to what we believe.