The opening paragraph of the chapter provides a great place to begin to analyze mood:
A throng of bearded men, in sad-colored garments, and gray, steeple-crowned hats [...] was assembled in front of a wooden edifice, the door of which was heavily timbered with oak, and studded with iron spikes.
Words like "sad-colored" and even "gray" point to a bleak and cheerless mood. Further, the fact that the hats are "steeple-crowned" clues us in on how prominent a role religion will play in this text, but, combined with the other words in the paragraph, we don't get the sense that we are talking about religion in some kind of uplifting, inspirational sort of way; no, this religion seems dark and punitive. Next, the building is described in terms of the heaviness of its wood and the punishing description of the iron spikes. That the materials are so unyielding -- oak and iron -- has implications for the people just described and the community that built this edifice. This description reveals the mood to feel harsh, strict, and tightly controlled. Finally, the "iron spikes" contribute to a menacing mood; there is danger here, and the danger comes at the hands of the community that would build and then congregate around such a building.
When analyzing the mood of a book or passage, you can substitute the words "tone" or "attitude" to help you discern a description that is accurate. Chapter one of The Scarlet Letter does not necessarily jump into the action of the story itself. No characters are introduced. Instead, it is a short chapter used to establish the somber and severe tone of the entire novel, the historical perspective of the story, and the objective voice of the story-teller.
Chapter one establishes a somber and severe mood by describing a somber and severe object present in the colony where the story takes place: the prison door. The door has a "beetle-browned and gloomy front" (45). It is neither a positive nor beautiful place. And, "Like all that pertains to crime, it seemed never to have known a youthful era" (45). The door and the prison itself seem to have been built old and established.
This mood establishes the tradition of the Puritans and the importance they therefore place on punishment. As the action opens in the next chapter with the prison as the background for introduction to the "sinner" of the story, the scene has been set that this is a serious and severe time in America's history, full of serious and severe people as well as buildings.