The Defense Ministry press office, the Federal Security Service and a spokesman for the Northern Fleet said Alexander Kuzminykh, 19, committed suicide during the security operation, the Interfax and ITAR-Tass news agencies reported.
Interfax had earlier cited the Federal Security Service as saying Kuzminykh was killed by an anti-terrorist unit that was dispatched to the submarine after he refused to surrender.
Kuzminykh, who was drafted into the navy last year, went on a shooting spree overnight Thursday on the vessel in Severomorsk, near the northern port of Murmansk, the Defense Ministry said Friday.
He stole a machine gun and shot the crew members to death before barricading himself in the vessel's torpedo section, officials said.
The submarine belonged to the Bars class, a fleet submarine normally armed with nuclear cruise missiles and torpedoes, navy officials said.
There were no missiles on board the docked submarine. Still, the torpedo compartment where Kuzminykh was holed up did contain conventional explosives, Interfax reported.
Interfax said Kuzminykh had been in detention on disciplinary charges when he seized the weapon. He apparently used drugs and his mother said he had suffered from psychological problems in childhood, ITAR-Tass said.
There has been a rash of mass killings in the Russian armed forces, which are plagued by brutal living conditions. The military is chronically short of money because of the country's economic problems and hazing of servicemen is a major problem.