Although the movie is set in World War Two, the basic situation on which the story is loosely based is that of the World War One naval battles of Coronel in the South Pacific and the Falkland Islands in the South Atlantic, both of which took place in 1914. As in the film, a British cruiser force was defeated in the first battle by a superior German force and then Royal Navy reinforcements sent from England allowed the British to triumph in the second encounter.
The ship portraying the German cruiser "Essen" that the lead character battles with is actually a British vessel, mocked up to look vaguely like a German warship. It's HMS Manxman (N70), an Abdiel-class minelayer. The ship was named for an inhabitant of the Isle of Man.
The plot of the film is based on C. S. Foresters 1929 book "Brown on Resolution".
The scene on Resolution Island (supposedly part of the Galápagos) was filmed in Dwejra Bay on Gozo, Malta. The Essen's chart of the bay shows the bay's outline correctly (i.e. as the Maltese location), but the coastline shown south of the bay is fictional. There are in fact two entrances to Dwejra Bay - as its wide entrance is separated by a small rocky island, Fungus Rock - but shots are framed such that only one narrow entrance to the bay is ever shown.
The story behind "Sailor of the King" was previously adapted for the 1935 film "Born to Glory" (later released as "Forever England), starring John Mills.