Willie Keith, the somewhat chubby, Princeton-educated son of aristocratic Manhasset, Long Island parents, joins the Navy. Mrs. Keith drops him off, lavishing on him all of the motherly pampering she can before he leaves. Willie goes into the Columbia University School of Journalism, which has been converted for the war effort. He is almost rejected for physical reasons, but his Princeton background carries him though. Willie meets his roommates, Roland Keefer, a chubby, lazy, dedicated man from a military prep school, and Edwin Keggs, a high school algebra teacher. The three of them will live in Furnald Hall. Many hijinks ensue, but all three men make the cut and earn positions as officers in the Navy. Willie is almost kicked out on demerits he gets because of his relationship with a lounge singer, May Wynn. He likes May a lot, but thinks of her as a fun fling. She is from a lower class Italian family, which makes her unsuitable in Willie's eyes.
Willie is assigned to the DMS Caine for minesweeping duty in Pearl Harbor, but he arrives to find the ship already departed. Willie and Roland manage to get plush shore assignments until the Caine returns, mostly because of Willie's piano playing for a resident admiral. When the Caine returns to port, Willie is dragged from a drunken sleep early in the morning to join the crew. The ship is in bad repair, and is run by a tyrant named De Vriess. Willie is indoctrinated into the ship's ragtag communications department, which is managed by Lieutenant Tom Keefer, Roland's brother and a budding novelist. The ship spends its time in Pearl Harbor running exercises and performing menial tasks. Willie writes to May regularly and eagerly awaits her replies. One day Willie forgets about an urgent dispatch in his pocket while observing a minesweeping exercise from the bridge. De Vriess chews him out for the incident when he discovers the missing log, and Willie takes offense. Willie considers asking for reassignment, he changes his mind upon receiving a package from his father, who on his deathbed sent Willie a Bible and a note telling him, among other things, to do his absolute best at whatever he committed to. Willie stays on the Caine.
A new captain takes command of the ship: Lieutenant Commander Philip Francis Queeg, who surprises the crew of the Caine by arriving unannounced and catching the ship in its disheveled state. Though the Caine is his first command, and he has never served on a four-pipe minesweeper before, Queeg completes the transfer of command in a mere forty-eight hours, without allowing De Vriess to show him how the ship really works. As soon as De Vriess leaves the ship, things begin to change. Queeg begins making new demands of the crew in an attempt to restore it to Navy regulations. Willie takes to the new captain at once. Queeg's first attempt at conning the ship is a complete disaster. He attempts to turn the ship too quickly when backing out of the slip and badly scrapes the side of a neighboring ship. Queeg then forgets to stop the engines and grounds the ship on the other side of the channel. In another symbolic incident, while Queeg is busy reprimanding a sailor for having his shirttail out, he forgets to stop the ship's turn, and accidentally crosses and cuts the towline they had been using to drag targets. These incidents cause Pacific Command to become suspicious of the new captain of the Caine, so they send him to San Francisco for a refitting instead of sending him directly to combat action. Even on this very safe mission, Queeg creates trouble by trying to smuggle liquor to the states. The loss of the booze falls on Willie and he is forced to pay for it before he is allowed to take shore leave.
May Wynn and Mrs. Keith are both waiting for their war hero in San Francisco when the Caine finally arrives. Willie is forced to introduce May to his mother for the first time. Mrs. Keith is not exactly pleased with Willie's girlfriend, but she still allows her son to take May to Yosemite for the weekend. On the trip, May and Willie sleep together for the first time, greatly complicating their relationship. The next day, Willie proposes to May, but she gives no definite answer, and the issue is deferred. Back in San Francisco, Willie has a long talk with his mother about May, and is still convinced that his relationship will not work out.
When the Caine finally makes it to combat action, Captain Queeg's performance reveals further weaknesses in his ability to command. On a routine escort mission, the captain panics upon realizing how close they will have to go to the shore, and speeds ahead of the group that the Caine was supposed to protect. In another incident, a neighboring ship is straddled by gunfire from a shore battery. Though the battery is easily within range, Queeg does not fire a shot, but instead steams off as fast as the Caine's engines allow. When the ship patrols enemy waters, Queeg always stands on the side of the ship farthest from the shore, which adds to the crew's suspicions of cowardice in their captain. On top of this, the captain piles ridiculous punishments on the crew in response to menial offenses, ordering water famines, denial of liberties, and deprivation of sleep. The executive officer, a peacetime fisherman named Steve Maryk begins a secret log of the captain's questionable activities.
Tensions between captain and crew come to a head when an unexpected hurricane strikes the Caine while it is supporting a fueling convoy for the attack on the Philippines. The ship is unable to maintain its course because of the strength of the wind. Despite this, Queeg ignores Maryk's recommendations to save the ship by ballasting the water tanks, securing the ammunition, and coming into the wind. The captain becomes frozen with fear, clutching the engine telegraph and responding only to insist that they maintain fleet course with their stern into the wind. Finally, the wind takes the ship and swings it broadside to the waves. Maryk states that he is relieving Queeg of command due to his mental sickness on the authority of article 184 of Naval Regulations. Willie, as officer of the deck, is forced to confirm or deny the order, and he sides with Maryk. The exec successfully pilots the ship out of the typhoon and even picks up survivors from a downed destroyer in the process. Queeg asks to reassume command several times, but Maryk sticks to his decision to take responsibility for the ship and crew.
When the Caine arrives back in port, proceedings for a court martial begin immediately. Queeg is kept on shore to undergo a lengthy psychological examination, but Maryk is ordered to take the Caine back out to help with some urgent escort duty. On the tour, the Caine is struck by a kamikaze, but Maryk handles the fire fighting and damage control perfectly. When the ship finally arrives back in San Francisco, the court martial proceedings begin in earnest. All of the Navy's legal officers shun assignment to the case, predicting that defending mutineers would ruin their careers. Finally, a Jewish lawyer from New York, Barney Greenwald, takes the case. Willie is given pity leave to visit his family and May before he has to testify. He goes back determined to break off his relationship with May. The first night of Willie's leave, he ends the relationship and promises to call, knowing that he will not.
Greenwald gets Maryk acquitted by using dirty tricks and playing on predictable Navy mentalities. He confuses the two psychologists and gets them to admit that though Queeg is normally well adjusted, he is prone to breakdown in certain extreme circumstances. Greenwald uses Willie's heated testimony to reveal the captain's cowardice, which the distinguished sailors in the jury find embarrassing. Greenwald puts so much stress on Queeg while Queeg testifies that he becomes the panicky paranoid he had been at sea. After the acquittal, the sailors proceed to a party thrown by Keefer with the money he received for the presale of his war novel. Though Keefer had betrayed his friend in the courtroom to protect himself, Keefer is the most jubilant of all he celebrators. Greenwald stumbles in drunk and reprimands the crew for destroying a sacred military trust. He says it was the Queegs of the regular Navy who saved his Jewish grandmother. Greenwald ends the toast by throwing his champagne in Keefer's face, exposing him as the true source of blame for the mutiny.
All of the accused are free to continue their military careers. The crew of the Caine is mostly split up to reduce the chance of another incident. Maryk is given an insulting command of a lowly transport craft, and Queeg is assigned to a supply depot in Iowa. Keefer remains on the Caine and becomes captain. Willie is elevated to the position of executive officer. To the surprise of the crew, Keefer becomes just like Queeg, hiding from the crew most of the time and leaving his cabin only to scold and punish people for trivial offenses. His first test as captain arises when a kamikaze crashes into the mid- ship area of the Caine and causes massive damage. Keefer abandons ship, diving into the Pacific with the manuscript of his novel clutched under his good arm. Willie remains onboard, and with the help of some other brave sailors, eventually manages to put out the fire and get the ship underway again. They pick up the sailors who jumped, including Keefer, who swears that Willie will get a medal for his bravery.
In the near-death experience of the kamikaze hit, Willie's life flashed before his eyes, and he realized that the one thing he regretted was not marrying May Wynn. That night, Willie writes her an eight-page letter begging her to forgive him and be his wife. He sends it away and spends the last months of the war eagerly awaiting a reply. The reply never arrives. When the war ends, Keefer is decommissioned and Willie becomes captain of the damaged Caine. Another typhoon strikes, but Willie expertly manipulates the ship's rudder and engines to keep it from dragging anchor. The next day, in a rash move, Willie and his old midshipmen's school buddy Keggs go to fleet command to request permission to take the Caine back to the states for scrapping. The Caine is so badly damaged she could neither perform minesweeping duties nor risk weathering another hurricane. Willie convinces the operations officer to let him take the Caine back to New York so that the Navy will at least get scrap value for the old hulk.
Three weeks later, without pomp, the Caine arrives for decommissioning in Bayonne, New Jersey. Willie performs the ship's last solemn rites, and then allows his mother to drive him back home, exactly as she had dropped him off more than a year ago. Willie interrupts May Wynn at a rehearsal in New York. She has become a big success as a singer and begun dating her bandleader. Willie once again asks May to marry him, and though the book ends with the question unanswered, the two part on good terms, promising to see each other the next day.