Ishmael travels in December from Manhattan Island to New Bedford with plans to sign up for a whaling voyage. The inn where he arrives is overcrowded, so he must share a bed with the tattooed Polynesian Queequeg, a harpooneer whose father was king of the fictional island of Rokovoko. The next morning, Ishmael and Queequeg attend Father Mapple's sermon on Jonah, then head for Nantucket. Ishmael signs up with the Quaker ship-owners Bildad and Peleg for a voyage on their whaler Pequod. Peleg describes Captain Ahab: "He's a grand, ungodly, god-like man" who nevertheless "has his humanities". They hire Queequeg the following morning. A man named Elijah prophesies a dire fate should Ishmael and Queequeg join Ahab. While provisions are loaded, shadowy figures board the ship. On a cold Christmas Day, the Pequod leaves the harbor.
Ishmael discusses cetology (the zoological classification and natural history of the whale), and describes the crew members. The chief mate is 30-year-old Starbuck, a Nantucket Quaker with a realist mentality, whose harpooneer is Queequeg; second mate is Stubb, from Cape Cod, happy-go-lucky and cheerful, whose harpooneer is Tashtego, a proud, pure-blooded Indian from Gay Head, and the third mate is Flask, also from Martha's Vineyard, short, stout, whose harpooneer is Daggoo, a tall African, now a resident of Nantucket.
When Ahab finally appears on the quarterdeck, he announces he is out for revenge on the white whale which took one leg from the knee down and left him with a prosthesis fashioned from a whale's jawbone. Ahab will give the first man to sight Moby Dick a doubloon, a gold coin, which he nails to the mast. Starbuck objects that he has not come for vengeance but for profit. Ahab's purpose exercises a mysterious spell on Ishmael: "Ahab's quenchless feud seemed mine". Instead of rounding Cape Horn, Ahab heads for the equatorial Pacific Ocean via southern Africa. One afternoon, as Ishmael and Queequeg are weaving a mat — "its warp seemed necessity, his hand free will, and Queequeg's sword chance" — Tashtego sights a sperm whale. Five previously unknown men appear on deck and are revealed to be a special crew selected by Ahab. Their leader, Fedallah, a Parsee, is Ahab's harpooneer. The pursuit is unsuccessful.
Southeast of the Cape of Good Hope, the Pequod makes the first of nine sea-encounters, or "gams", with other ships: Ahab hails the Goney (Albatross) to ask whether they have seen the White Whale, but the trumpet through which her captain tries to speak falls into the sea before he can answer. Ishmael explains that because of Ahab's absorption with Moby Dick, he sails on without the customary "gam", which defines as a "social meeting of two (or more) Whale-ships", in which the two captains remain on one ship and the chief mates on the other. In the second gam off the Cape of Good Hope, with the Town-Ho, a Nantucket whaler, the concealed story of a "judgment of God" is revealed, but only to the crew: a defiant sailor who struck an oppressive officer is flogged, and when that officer led the chase for Moby Dick, he fell from the boat and was killed by the whale.
Ishmael digresses on pictures of whales, brit (microscopic sea creatures on which whales feed), squid and — after four boats lowered in vain because Daggoo mistook a giant squid for the white whale — whale-lines. The next day, in the Indian Ocean, Stubb kills a sperm whale, and that night Fleece, the Pequod's black cook, prepares him a rare whale steak. Fleece delivers a sermon to the sharks that fight each other to feast on the whale's carcass, tied to the ship, saying that their nature is to be voracious, but they must overcome it. The whale is prepared, beheaded, and barrels of oil are tried out. Standing at the head of the whale, Ahab begs it to speak of the depths of the sea. The Pequod next encounters the Jeroboam, which not only lost its chief mate to Moby Dick, but also is now plagued by an epidemic.
The whale carcass still lies in the water. Queequeg mounts it, tied to Ishmael's belt by a monkey-rope as if they were Siamese twins. Stubb and Flask kill a right whale whose head is fastened to a yardarm opposite the sperm whale's head. Ishmael compares the two heads in a philosophical way: the right whale is Lockean, stoic, and the sperm whale as Kantean, platonic. Tashtego cuts into the head of the sperm whale and retrieves buckets of oil. He falls into the head, and the head falls off the yardarm into the sea. Queequeg dives after him and frees his mate with his sword.
The Pequod next gams with the Jungfrau from Bremen. Both ships sight whales simultaneously, with the Pequod winning the contest. The three harpooneers dart their harpoons, and Flask delivers the mortal strike with a lance. The carcass sinks, and Queequeg barely manages to escape. The Pequod's next gam is with the French whaler Bouton de Rose, whose crew is ignorant of the ambergris in the gut of the diseased whale in their possession. Stubb talks them out of it, but Ahab orders him away. Days later, an encounter with a harpooned whale prompts Pip, a little black cabin-boy from Alabama, to jump out of his whale boat. The whale must be cut loose, because the line has Pip so entangled in it. Furious, Stubb orders Pip to stay in the whale boat, but Pip later jumps again, and is left alone in the immense sea and has gone insane by the time he is picked up.
Cooled sperm oil congeals and must be squeezed back into liquid state; blubber is boiled in the try-pots on deck; the warm oil is decanted into casks, and then stowed in the ship. After the operation, the decks are scrubbed. The coin hammered to the main mast shows three Andes summits, one with a flame, one with a tower, and one a crowing cock. Ahab stops to look at the doubloon and interprets the coin as signs of his firmness, volcanic energy, and victory; Starbuck takes the high peaks as evidence of the Trinity; Stubb focuses on the zodiacal arch over the mountains; and Flask sees nothing of any symbolic value at all. The Manxman mutters in front of the mast, and Pip declines the verb "look".
The Pequod next gams with the Samuel Enderby of London, captained by Boomer, a down-to-earth fellow who lost his right arm to Moby Dick. Nevertheless, he carries no ill will toward the whale, which he regards not as malicious, but as awkward. Ahab puts an end to the gam by rushing back to his ship. The narrator now discusses the subjects of (1) whalers supply; (2) a glen in Tranque in the Arsacides islands full of carved whale bones, fossil whales, whale skeleton measurements; (3) the chance that the magnitude of the whale will diminish and that the leviathan might perish.
Leaving the Samuel Enderby, Ahab wrenches his ivory leg and orders the carpenter to fashion him another. Starbuck informs Ahab of oil leakage in the hold. Reluctantly, Ahab orders the harpooneers to inspect the casks. Queequeg, sweating all day below decks, develops a chill and soon is almost mortally feverish. The carpenter makes a coffin for Queequeg, who fears an ordinary burial at sea. Queequeg tries it for size, with Pip sobbing and beating his tambourine, standing by and calling himself a coward while he praises Queequeg for his gameness. Yet Queequeg suddenly rallies, briefly convalesces, and leaps up, back in good health. Henceforth, he uses his coffin for a spare seachest, which is later caulked and pitched to replace the Pequod's life buoy.
The Pequod sails northeast toward Formosa and into the Pacific Ocean. Ahab, with one nostril, smells the musk from the Bashee isles, and with the other, the salt of the waters where Moby Dick swims. Ahab goes to Perth, the blacksmith, with a bag of racehorse shoenail stubs to be forged into the shank of a special harpoon, and with his razors for Perth to melt and fashion into a harpoon barb. Ahab tempers the barb in blood from Queequeg, Tashtego, and Daggoo.
The Pequod gams next with the Bachelor, a Nantucket ship heading home full of sperm oil. Every now and then, the Pequod lowers for whales with success. On one of those nights in the whaleboat, Fedallah prophesies that neither hearse nor coffin can be Ahab's, that before he dies, Ahab must see two hearses — one not made by mortal hands and the other made of American wood — that Fedallah will precede his captain in death, and finally that only hemp can kill Ahab.
As the Pequod approaches the Equator, Ahab scolds his quadrant for telling him only where he is and not where he will be. He dashes it to the deck. That evening, an impressive typhoon attacks the ship. Lightning strikes the mast, setting the doubloon and Ahab's harpoon aglow. Ahab delivers a speech on the spirit of fire, seeing the lightning as a portent of Moby Dick. Starbuck sees the lightning as a warning, and feels tempted to shoot the sleeping Ahab with a musket. Next morning, when he finds that the lightning disoriented the compass, Ahab makes a new one out of a lance, a maul, and a sailmaker's needle. He orders the log be heaved, but the weathered line snaps, leaving the ship with no way to fix its location.
The Pequod is now heading southeast toward Moby Dick. A man falls overboard from the mast. The life buoy is thrown, but both sink. Now Queequeg proposes that his superfluous coffin be used as a new life buoy. Starbuck orders the carpenter take care it is lidded and caulked. Next morning, the ship meets in another truncated gam with the Rachel, commanded by Captain Gardiner from Nantucket. The Rachel is seeking survivors from one of her whaleboats which had gone after Moby Dick. Among the missing is Gardiner's young son. Ahab refuses to join the search. Twenty-four hours a day, Ahab now stands and walks the deck, while Fedallah shadows him. Suddenly, a sea hawk grabs Ahab's slouched hat and flies off with it. Next, the Pequod, in a ninth and final gam, meets the Delight, badly damaged and with five of her crew left dead by Moby Dick. Her captain shouts that the harpoon which can kill the white whale has yet to be forged, but Ahab flourishes his special lance and once more orders the ship forward. Ahab shares a moment of contemplation with Starbuck. Ahab speaks about his wife and child, calls himself a fool for spending 40 years on whaling, and claims he can see his own child in Starbuck's eye. Starbuck tries to persuade Ahab to return to Nantucket to meet both their families, but Ahab simply crosses the deck and stands near Fedallah.
On the first day of the chase, Ahab smells the whale, climbs the mast, and sights Moby Dick. He claims the doubloon for himself, and orders all boats to lower except for Starbuck's. The whale bites Ahab's boat in two, tosses the captain out of it, and scatters the crew. On the second day of the chase, Ahab leaves Starbuck in charge of the Pequod. Moby Dick smashes the three boats that seek him into splinters and tangles their lines. Ahab is rescued, but his ivory leg and Fedallah are lost. Starbuck begs Ahab to desist, but Ahab vows to slay the white whale, even if he would have to dive through the globe itself to get his revenge.
On the third day of the chase, Ahab sights Moby Dick at noon, and sharks appear, as well. Ahab lowers his boat for a final time, leaving Starbuck again on board. Moby Dick breaches and destroys two boats. Fedallah's corpse, still entangled in the fouled lines, is lashed to the whale's back, so Moby Dick turns out to be the hearse Fedallah prophesied. "Possessed by all the fallen angels", Ahab plants his harpoon in the whale's flank. Moby Dick smites the whaleboat, tossing its men into the sea. Only Ishmael is unable to return to the boat. He is left behind in the sea, and so is the only crewman of the Pequod to survive the final encounter. The whale now fatally attacks the Pequod. Ahab then realizes that the destroyed ship is the hearse made of American wood in Fedallah's prophesy. The whale returns to Ahab, who stabs at him again. The line loops around Ahab's neck, and as the stricken whale swims away, the captain is drawn with him out of sight. Queequeg's coffin comes to the surface, the only thing to escape the vortex when Pequod sank. For an entire day, Ishmael floats on it, until the Rachel, still looking for its lost seamen, rescues him.