The story of "Young Goodman Brown" is allegorical. All the elements of this story represent abstract ideas far beyond their literal meanings. Hawthorn uses symbolism to convey the loss of innocence and the realization that evil exists all around Goodman Brown. The symbolism in his journey away from Faith, his home, and safety and into evil is obviously illustrated in the setting that Hawthorn chooses.
Firstly, Hawthorn sets up the time period as the historically significant Salem Massachusetts of the 1690's. "And it was I that brought your father a pitch-pine knot in King Philip's War." If Goodman Brown's father fought in this war in 1675 his son would be of marrying age around 1690. This time and place was ripe with religious persecution and strict moral codes. With such ethical and spiritual ----- now hanging in the air, the reader can sense the message of morality, right vs. wrong, good vs. evil.
The village of Salem itself represents the goodness in Mr. Brown's life. With its straight and open streets, and simple organization and structure, it is where Goodman belongs. It is safe and it is pure and it must be left behind.
The forest then represents the evil, so nearby his whole life, but that he never before dared to explore. "He had taken a dreary road, darkened by all the gloomiest trees of the forest, which barely stood aside to let the narrow path creep through and closed immediately behind" Symbolically, Mr. Brown is stepping directly into evil surrounded by the darkest and gloomiest of spirits; so much so that they are crowding him on this path. The idea that he will never be able to simply return to the life of innocence from which he came can be seen in the image of the forest closing behind and cutting off the path back. .
Hawthorn then uses the setting to symbolize the psychological processes one may go through when contemplating turning to the dark side. ""It was all as lonely as could be- symbolizes the feeling of singularity in choosing this path.