To expand upon the answer from the other editor, young Goodman Brown's adventure in the woods (regardless of whether or not it was real of imagined) shakes his faith in himself, his wife, humanity as a whole, and even in his religion.
The rest of his life is spent questioning not only what happened in the woods, but it is also spent questioning the behaviors and beliefs of everyone around him. Young Goodman Brown grows more and more cynical with every passing day. This is the "gloom" that consumes him until his dying hour.
At the very end of the story, Young (I guess he's not young anymore ) Goodman Brown dies. He is followed to his grave by Faith and by their kids and their grandkids. When they bury him in his grave,
there is no hopeful verse upon his tombstone, for his dying hour was gloom.
If you are asking about the part a bit before that, what happens is that what he sees in the forest makes him lose his faith and his hope. He thinks everyone is corrupt and evil, so he has no good thoughts about anyone. We don't know whether what he saw in the forest really happened, but it doesn't matter. He acts as if it does and it ruins his life.
Young Goodman Brown (as the above poster said is not young anymore) questions everyone around him. He sees the minister and snatches the girl away he is talking to, he does not have anything to do with his wife. He has become bitter and dies a lonely man. The sad part is that he doesn't even know whether the whole journey into the forest was real or a dream!