In "Young Goodman Brown," the eponymous protagonist heads off into the forest to participate in a kind of strange Satanic ritual that, in his view, represents everything evil and debased. Living as he does in a small Puritan town full of God-fearing people, Brown is clearly keen to...
step outside the moral boundaries of his strict culture.
But regardless of his motivations for entering the forest, Brown soon finds himself utterly unnerved by what he sees. The presence of so many respectable pillars of society participating in this devilish mass forces him to reconsider his previously high opinions of them. It also makes him realize how sinful he is being in looking for a thrill.
He figures that from now on he will dedicate his life to God, which will entail shunning those local worthies who participated in the Satanic ritual in the woods. Unfortunately, it also entails his turning into a solitary, miserable old man. Because Brown cannot trust anyone, and because no one comes up to the high standards of religious morality he's set for himself, he is all alone in the world.
One cannot help thinking this is a just punishment for Brown's great hypocrisy. After all, he too went into the forest on a "present evil purpose." So it's arguably fitting that he should suffer for his own double standards.