Lieutenant Commander Ian Molyneux would have fallen unconscious instantly after he suffered the gunshot wound, the inquest heard.
Able Seaman Ryan Donovan, 23, was jailed for life and to serve a minimum of 25 years after pleading guilty to the murder of Lt Cdr Molyneux on the HMS Astute, which is traditionally based at Faslane.
He also pled guilty to attempting to murder Lieutenant Commander Christopher Hodge, 45, who he shot in the stomach.
The vessel was docked at Southampton, Hampshire, at the time of the attacks.
Donovan was only stopped when the leader of Southampton City Council, Royston Smith, and its chief executive, Alistair Neill, wrestled the weapon from him.
The inquest, which resumed at Southampton yesterday, heard Lt Cdr Molyneux, 36, suffered a single gunshot wound to his head, six inches above his right earhole.
Home Office pathologist Dr Basil Purdue said: "It would have caused instantaneous unconsciousness, followed very, very shortly by death.
"The Lieutenant Commander would have known nothing about it."