The story starts out on April 1, 1800, in Port Mahon, Minorca, a base of the Royal Navy. A shipless lieutenant wasting away in port, Jack Aubrey, meets Stephen Maturin, a penniless half-Irish and half-Catalan physician and natural philosopher, at an evening concert at the Governor’s Mansion. An offence against honour arises when Jack Aubrey gets elbowed by Maturin to stop beating "a half measure ahead" of the time while the string quartet is playing. Each man is at a low point; they exchange names and locations (so that their seconds might call upon them to arrange a duel).
Later that evening, at his living quarters, Jack Aubrey learns that he has been promoted to the rank of commander and has been given command of the brig HMS Sophie . Meeting Maturin in the street the next day, Aubrey's joy overcomes his animosity and he invites Maturin to dine. Maturin accepts. They discover a shared love of music and a similar level of talent in the other: Aubrey plays the violin and Maturin the cello. Upon learning that Maturin is a physician Aubrey, somewhat impetuously, asks him to sign on and ship with him, the surgeon for Aubrey's new ship having left with the previous captain. Although Maturin is a physician, with training far beyond the naval designation of 'surgeon', he agrees, as he is currently unemployed.
In Sophie 's crew are master's mates Thomas Pullings, William Mowett, midshipman William Babbington, and James Dillon, the first lieutenant. Dillon and Maturin met earlier as members of the United Irishmen, a secret they keep between them. Three men about the same age, Aubrey, Dillon and Maturin, begin an adventure on Sophie .
Aubrey improves Sophie 's sailing qualities by adding a longer yard which allows him to spread a larger mainsail. She then is sent to accompany a small convoy of merchant ships. During their journey east, the new captain, Aubrey, takes the opportunity to get to know his sailors and work them into a fighting unit, with the aid of Lieutenant Dillon. As he does this, he and the crew explain many naval matters to Maturin (and to the reader) since the doctor has never served aboard a man-of-war, including the gaining of prize money for capturing enemy vessels. Maturin quickly makes friends aboard the ship for his medical skills and his joy in finding rare birds and fish. The crew treat him as a landsman, but without insult.
After the convoy duties, Lord Keith allows Aubrey to cruise independently, looking for French merchants. After a number of prizes are taken, they meet and defeat the Cacafuego , a Spanish xebec-frigate, losing a number of crew, including Dillon, in the bloody action and gaining the respect of other naval officers. However, Captain Harte, the commandant at Mahon, has a grudge against Aubrey, who has been having an affair with his wife. Harte's malevolence ensures that the victory brings Aubrey and his crew no official recognition, promotion, or significant prize money, although Aubrey gains a reputation among members of the Royal Navy as one of its great, young fighting captains. The loss of Dillon is great to both Aubrey and Maturin, and felt in the ship, especially when his replacement is nowhere near his match.
On her following escort duty, Sophie is captured by a squadron of four large French warships after a pursuit and a brave but hopeless resistance. The French Captain Christy Pallière is most courteous to Aubrey; he tells Aubrey of his cousins in Bath, and feeds them well. The Battle of Algeciras begins, and after a short period as prisoners of war aboard Desaix , they are exchanged; awaiting their trial, the Sophies miss the fighting but observe it closely from Gibraltar. After the battle, Aubrey undergoes a court-martial over the loss of his ship, and he is cleared of the charges.