This is a good question. The story "Young Goodman Brown" opens with a strange exchange between the title character and his wife, Faith. Faith wants him to stay home, but he replies that he has business in the woods at night:
"My love and my Faith," replied young Goodman Brown, "of all nights in the year, this one night must I tarry away from thee. My journey, as thou callest it, forth and back again, must needs be done 'twixt now and sunrise. What, my sweet, pretty wife, dost thou doubt me already, and we but three months married!"
Young Goodman Brown clearly has some sort of business in the forest, the reader is told, and this business must take place under the cover of darkness.
To me, Young Goodman Brown's insistence on the necessity of his journey away from the village of Salem at night is what drives the story forward. If he had indeed stayed home, he wouldn't have seen his neighbors and, indeed, even his wife participating in the black mass in the forest. He seems compelled to leave his comfortable home and go looking for trouble.
When Young Goodman Brown meets the devil in the woods, the reader has the sense this meeting was the purpose of the nocturnal journey. He greets the devil with a revealing statement:
"Friend ... having kept covenant by meeting thee here, it is my purpose now to return whence I came. I have scruples, touching the matter thou wot'st of."
Thus, the reader can be fairly certain at this point in the story that the real reason for Young Goodman Brown's journey into the woods at night is to meet up with this strange man with the staff.
Of course, the story doesn't have to be read as a literal meeting between the man and the devil. To me, this story seems very much like a psychological journey within Young Goodman Brown's own conscience. In the course of the journey, he attempts to come to terms with the hypocrisy and moral failing of the world around him. He fails in this attempt, however, and thus becomes very bitter toward the world.