Several factors are believed to have contributed to the dark tone found in many of Hawthorne's writings. First, Hawthorne grew up in a very strictly religious environment in New England, something that becomes a reoccurring theme in his stories. We can see the struggle that he had with the legalism of Puritan New England in stories such as The Scarlet Letter, "The Birthmark," and "Young Goodman Brown," among others. In addition to this strict background, Hawthorne is writing in the Romantic era, when Transcendental philosophies are becoming more widely accepted. His friendships with Transcendental writers such as Emerson and Melville may have influenced his negative attitude towards the beliefs of his family.
The event that is most likely the biggest factor is the Salem Witch Trials. Judge Hathorne was an ancestor of Nathaniel Hawthorne, and was instrumental in the hanging of several innocent people for supposedly being a witch. Hawthorne felt the weight of this event greatly. In fact, it is believed by some that Nathaniel Hawthorne changed the spelling of his name to detach himself from this tragedy. All of these factor contribute to the negative perspective of Puritanism seen in Hawthorne's writings.