Rum is closely associated with naval and pirate traditions, as seen with many naval-branded rums (Captain Morgan, Kraken) and the famous Pirates of the Caribbean line "Why is the rum always gone?
Why is this?
Interesting question, you could've found the answer just like I did from a search.
Rum lasts longer than beer or wine, this means it lasted throughout their expedition and they needn't drop anchor often to refill.
Rum, Scotch, Whiskey, and Vodka - These spirits all have a relatively long shelf life because of the high alcohol content. They will be even better if they are left unopened, but normally can be kept for a few years once opened.
Wine - Once opened, a bottle of wine begins to oxidize rapidly. While red wine may last a day or two longer than white wine, neither will be very palatable after two or three days. Oxidization doesn't make wine toxic, but it will cause it to taste unpleasant. Putting the cork back into an opened bottle of wine and putting it in the fridge will keep it from over-maturing for about a week
Availability & Cost:
Though rum was known for a long time, rum was available in plenty from the Carribean in low costs.
The Eastern Caribbean islands were colonized for agricultural interests in the 17th century. At that time, it was necessary for armed naval vessels to sail with the planters to defend them from pirates and the navies of their European enemies. The crews generally felt little more than contempt and resentment toward the planters whom they were sent to protect. From the sailors' point of view, shepherding planters and their merchant ships limited their chances of actually capturing a pirate or enemy prize and sharing in the profits. Deadly tropical diseases were rampant in the Caribbean, and without the hope of getting rich if they survived, sailors had little to look forward to beyond their daily allowance of drink.
Rum was an important article of trade in the Caribbean because of the sugar trade. Rum is the fermented distillate of molasses. During the age of exploration, molasses was normal product of sugar cane plantations because it is relatively easy to concentrate sugar cane to molasses. The molasses can then be converted to an even more valuable and concentrated product: rum.
The advantage of turning a commodity into one that is more valuable per unit volume is that more value/money can be shipped in the same volume. For example, a shipload full of rum is much more valuable than a shipload of sugar cane.
These trade dynamics made rum an important item of commerce in the Caribbean and sailors were often paid in rum, or it was part of their pay.
Rum is "associated with naval practice" mainly because it was issued to the sailors of the Royal navy. Earlier they used beer and/or wine as a part of daily ration. When the operations in Caribbean started, there were difficulties with procuring beer or wine. They tried rum, mixed with water. Gradually this became a tradition in the Royal navy. (Very slowly. They continued with rations of beer or wine for long time, and then used all three beverages). It ended only in 1970.
Details can be found here:
EDIT. To address @Tyler Durden comments. 1. For simplicity I used the latest name "Royal navy", it is irrelevant for the question how British navy was called before 1707.
The reason why rum is associated with navy (in popular movies and fiction) IS that the BRITISH navy used it. Otherwise nobody would care what they drunk in the Caribbean, as nobody cares what they drunk in Madagascar, or in the South China sea, or in the Mediterranean, or what they distributed as ration in Russian navy.
Short answer: Because sailors spent a lot of time in or near tropical latitudes (where rum was most available), protecting the "sea lanes,"(or raiding them, in the case of pirates).
As another poster pointed out, rum was made from sugar, a tropical product. It's true that rum could be manufactured in northern latitudes, but those products were largely bound for Africa in the Triangle (slave) trade. Rum could also be manufactured "locally" (near the sources of sugar).
Most (European) soldiers, on the other hand, fought and spent most of their time in nothern (mostly European) latitudes. It didn't make sense to "import" rum from the tropics when "scotch, whiskey, and vodka" were available.
The Royal Navy's connection with Rum as daily ration ended in 1970 (or early '70's) when the government of the day targeted defense spending and cut the daily ration of "grog" (Rum mixed with water) to the Jolly Jack Tars of the Royal Navy. This had an impact on the Caribbean Rum suppliers to the Navy, many of whom went out of business. I dare say it also had an impact on morale among the ratings.