The answer to this question lies at the very heart of the theme of this excellent short story. The severe and absolute transformation that Goodman Brown undergoes thanks to his night in the woods is remarkable, and so we must look to what happens during that night to explain the transformation. We can link it to the way in which Goodman Brown sees so many supposedly stalwart and upright members of his village involved with the devil. Note, for example, how Goody Close, the woman who taught Goodman Brown his catechism is presented:

But--would your worship believe it?--my broomstick hath strangely disappeared, stolen, as I suspect, by that unhanged witch, Goody Cory, and that too, when I was all annointed with teh juice of smallage, and cinquefoil, and wolf's-bane...

The destruction of the various heroes of Christianity that Goodman Brown has looked up to all his life certainly seems to underline the central message of the story, as delivered by the leader of the devil worshippers, who says to the assembled crowd:

Depending upon one another's hearts, ye had still hoped that virtue were not all a dream. Now are ye undeceived. Evil is the nature of mankind. Evil must be your only happiness. Welcome again, my children, to the communion of your race.

The story thus points towards evil as an essential part of the human condition that cannot be ignored or gainsaid. It is the discovery of this truth overall that results in Goodman Brown's alienation from his former life and those around him.