Melville's major source of inspiration for the story was an advertisement for a new book, The Lawyer's Story, printed in the Tribune and the Times on February 18, 1853. The book, published anonymously later that year, was written by popular novelist James A. Maitland. This advertisement included the complete first chapter, which started: "In the summer of 1843, having an extraordinary quantity of deeds to copy, I engaged, temporarily, an extra copying clerk, who interested me considerably, in consequence of his modest, quiet, gentlemanly demeanor, and his intense application to his duties." Melville biographer Hershel Parker said nothing else in the chapter besides this "remarkably evocative sentence" was notable. Critic Andrew Knighton said Melville may have been influenced by an obscure work from 1846, Robert Grant White's Law and Laziness: or, Students at Law of Leisure, which features an idle scrivener, while Christopher Sten suggests that Melville found inspiration in Ralph Waldo Emerson's essays, particularly "The Transcendentalist", which shows parallels to "Bartleby".
Melville may have written the story as an emotional response to the bad reviews garnered by Pierre, his preceding novel. Financial difficulties may also have played a part: Moby-Dick and Pierre sold so poorly that Melville was in debt to his publisher Harper & Brothers.