Victoria Ingles, senior curator at The National Museum of the Royal Navy said:
"These flags are a unique visual record of a boat's combat activities as well as a striking piece of folk art.
"The iconic Jolly Roger has become associated with the representation of pirates as swashbuckling rogues, cool rebels and fun children's characters but this exhibition exposes the dark side behind these stereotypical images.
"In reality, pirates commit brutal acts of violence and disrupt trade, which is why the Royal Navy still actively seeks to suppress their activities.
"Yet, despite fighting piracy, the practice of flying a Jolly Roger has also become tradition within the submarine service in response to a critic who likened them to pirates.
"Handcrafted, they are as much a symbol of pride and also poignant reminder of the impact of war."
The role of the Royal Navy in combating piracy is chronicled in the exhibition from the Jolly Roger belonging to Admiral Richard Curry which was seized at the end of the 18th century up to modern-day efforts.
The display starts on April 6 and is being held alongside a Horrible Histories Pirates exhibition.