Nuclear power is the only way to make submarines work underneath the water for long distances without coming up because of the oxygen that all other types require.
And batteries for electric engines are too heavy.
Historically a submarine had to go up to just below sea level to get air through a snorcel for the engines that charge the batteries.
Then it could go down and drive only as far as the batteries could get and then repeat the process. But because the batteries are huge and heavy, this is only a shourt distance.
Under water the diesel engines do not work, they need the oxygen out of the air.
This was a huge disadvantage at war times.
Nuclear power does not need the fresh air (the oxygen part of it) like all other types of generators who work with combustion engines and they need oxygen. So someone built a nuclear submarine and this was so superior to the old ones that they choosed to do it. They can travel and hide for months without coming up.
Some military ships are also nuclear powered:
http://www.radiationworks.com/nuclearships.htm
It allows them to travel longer distances without refueling.
For civilian ships it is probably too expensive.
For air planes it seems easier and safer and cheaper, compared to nuclear power, to just power them with cerosine. A reactor is heavy and has a certain size. Large ships can carry them.
Submarines and ships have unlimited waater cooling available.