We are given this information towards the end of the somewhat baffling introduction to this excellent novel, which generations of students have stumbled over in their eagerness to get to the far more readable story of Hester Prynne and the mystery of the scarlet letter.
The narrator, having taken his post in the Custom House to escape his more Romantic fancies and to apply parts of his intellect that he had not engaged before, finds himself increasingly dissatisfied with his lot:
To confess the truth, it was my greatest apprehension... it was my chief trouble, therefore, that I was likely to grow grey and decrepit in the Surveyorship, and become much such another animal as the old Inspector. Might it not, in the tedious lapse of official life that lay before me, finally be with me as it was with this venerable friend - to make the dinner hour the nucleus of the day, and to spend the rest of it as an old dog spends it, asleep in the sunshine or in the shade? A dreary look-forward this, for a man who felt it to be the best definition of happiness to live throughout the whole range of his faculties and sensibilities!
There we have it - for a character like the narrator, who is a creative, imaginative being at heart and has written before, the idea of being "locked" into this dreary career and living out the rest of his days like "an old dog" is anathema to him. Fortunately, however, Providence had other ideas, and so we are presented with the fascinating narrative of Hester Prynne.