As a form of compensation for his years of underwater claustrophobia, he took up yachting, set out to sail solo round the world and succeeded at the third attempt.
King was born in Hampshire, the son of a Royal Engineers officer who was a lieutenant colonel with the Distinguished Service Order (DSO) and was killed on the western front in 1917. His mother sent Bill to Dartmouth naval college and his initial posting was on a battleship in the Mediterranean as a midshipman. His first taste of the submarine service, for which he volunteered, came in 1932 aboard HMS Orpheus on the China Station, where he was promoted to lieutenant. Almost four years later he became "number one", or executive officer on a support vessel. Short stints on two more boats led to the notorious "perisher" course for would-be submarine captains at Portsmouth, which he passed.
After four months on a depot ship, King was given his first submarine command, HMS Snapper, in April 1939. Sent on patrols in the North Sea, Snapper's first taste of warfare was a very near miss from a bomb dropped off Harwich, Essex, in December 1939 by the RAF. The boat limped into the harbour without major damage and in the following eight months King sank six enemy ships off Jutland, earning his first DSO in spring 1940, followed by the Distinguished Service Cross in autumn that year.
During this period he also ran the boat aground off the Dutch coast but managed to refloat her without damage. The customary inquiry did not lead to a court martial but an invitation to drinks with the First Lord of the Admiralty, Winston Churchill, not long before he became prime minister.
In 1941 King was posted to the new and larger, ocean-going HMS Trusty, of the T-class, for service in the Mediterranean. At the end of the year, Lieutenant Commander King and Trusty were assigned to the far east, just in time for the great Japanese onslaught in the Indian and Pacific oceans. Bombed but unhurt in Singapore, King found total chaos as the island faced being overrun by the enemy. On his own initiative he made two patrols in the South China Sea, without result. He briefly retreated to Surabaya in the Dutch East Indies (now Indonesia), before they too were overrun, to repair an oil leak in case it betrayed his boat to the enemy.
A return to the Mediterranean for five months in 1943, as second-in-command of the Beirut submarine base in his new rank of commander, led to a meeting with the writer Anita Leslie, whom he married in 1949.
After Beirut he was given another boat in the far east, the T-class Telemachus, on which he served out the war, sinking a troopship and a supply ship. He was awarded a bar to his DSO for a successful duel with the Japanese submarine I-166, which sank. In September 1945 he began his last naval posting as executive officer of the large submarine depot ship HMS Forth. He resigned from the service rather than return to submarines.
After the war, King moved to Ireland to farm and acquired a ruined castle at Oranmore on the west coast near Galway. He and his wife spent an extended honeymoon sailing round the West Indies before draining their 150 acres and starting an organic farm, regularly riding to hounds with the Galway Blazers, after whom his first yacht was named.
In 1968 King made his first attempt to circumnavigate the globe in the junk‑rigged Galway Blazer II in the first round-the-world yacht race, in which he was the oldest contestant. Although relishing the contrast with serving on submarines, he had to give up when a record storm dismasted his yacht and he was towed into Cape Town. He tried again in 1970 but was forced by illness to go ashore in Western Australia. He started again from Fremantle at the end of 1971. His yacht was rammed by a whale or huge shark, forcing him to make hair-raising repairs at sea and limp back to Fremantle, but he finally sailed into Plymouth after two years away.
King wrote two volumes of autobiography and books on sailing.
Anita died in 1984. Their son and daughter survive him.
• William Donald Aelian King, submarine captain and yachtsman, born 23 June 1910; died 21 September 2012
guardian.co.uk © Guardian News and Media Limited 2010