Hawthorne was fascinated with issues of evil and guilt because his ancestor presided as a judge during the witch hyteria in Salem. However, central to "Young Goodman Brown" is the ambiguity Hawthorne maintains throughout. The story is ambiguous not only concerning whether or not Brown's experience is a dream but is also ambiguous concerning what it says about evil and human nature, and it is the relationship between these that I see as an important theme, and therefore a purpose of the story--to explore in what ways, or if, human nature is inherently evil--and what, in fact, "evil" looks like in our lives. Yes, Brown might be hypocritical; and yes, his neighbors might might engage (symbolically) with evil in the darkness of their lives; but perhaps more importantly the real evil is despair: lacking faith not so much in God but in humanity--accepting that evil might exist but that its presence does not / should not erase the value and joy of life. Or, some might argue that the real evil is the concept of "guilt" (real or imagined), which can lead people, such as Brown, into a tangle so that they see evil everywhere in their community.
Like his great novel, "The Scarlet Letter," Hawthorne uses "Young Goodman Brown" to illustrate the hypocrisy of the Puritans. This likely stems from the guilt he felt over having an ancestor who served as a judge for the Salem witch trials.
Notice as Brown enters into the wilderness how all of the people he once thought pure and dear to him, Goody Cloyse, Deacon Gookin, and the minister, as well as his own father and grandfather, seem to have an evil and dark side to them. Yet, back in Salem, these same people are the most pious and righteous. Notice too how the devil is able to bring all of the people, regardless of race, social standing, religious beliefs, and past reputations, in the area together at the dark mass, where they are welcomed to the communion of their race. The point is clear, the Puritans used religion as a means to segregate their society. Only through the human propensity for sin can the devil bring them all together without fighting or bickering or ridiculing one another. At the black mass the devil urges them to look upon each other and know they are equals in their sin. Everyone is guilty. Throughout his story, Hawthorne illustrates the hypocrisy evident in the Puritan society that was responsible for the Salem witch trials.
Hawthorne uses this allegorical tale to illustrate the hysteria of the Salem Witch Trials from the late 1600's. Brown bellieves that everyone around him is attending"black Meetings". He believes the people he loves and respects are consorting with the devil. In the end, it is not clear whether it was a dream or real. It really wouldn't matter, what was once a young, happy man is now bitter and lacking trust or joy.