In some photos of the U.S. Navy destroyers, you can see the pirate flag hanging high on the mast. In fact, as a regular army, the U.S. Navy will not be associated with pirates, so there must be a reason for hoisting the pirate flag. That is a quirky tradition inherited by the modern European and American navies: Line-crossing ceremony.
In the European and American naval systems (mainly the United Kingdom and the United States), the "Line-crossing Ceremony" is held to celebrate new sailors crossing the Equator for the first time, which is also known as the "Sailor's Initiation Rite." The earliest written records of this culture dates back to the 18th century. The original intention was to boost morale by setting up a "Fools’ Day", or use "tricky" approaches to ensure that all new sailors can withstand the hardships at sea. According to the usual practice, when holding the "Line-crossing Ceremony", the ship raises a flag with a white skull painted on a black background, which is the traditional "pirate flag."
On the other hand, flying the pirate flag is also the tradition of the Royal Navy Submarine Service. The connection between British submarines and the pirate flag can be traced back to 1914. At that time, a British submarine sank a German cruiser and a destroyer. Upon returning to the naval port, the submarine proudly raised the pirate flag. Since then, any submarine in the Royal Navy that has sunk an enemy ship will fly the pirate flag high when returning to port to show their victory. In April 2011, the nuclear submarine "HMS Victory" of the Royal Navy returned to the Portsmouth Naval Base in the United Kingdom after completing its mission to Libya, it hung a pirate flag with skulls and bones to celebrate.
The pirate flag tradition of the modern U.S. Navy was revived in World War II. In 1942, the first-generation Fletcher-class destroyer "USS Kidd" (DD-661) of the U.S. Navy was just launched. This ship was the first Navy ship named after Rear Admiral Isaac C. Kidd, the captain of the USS Arizona (BB-39), who died on his ship in the battle on Pearl Harbor. During the maiden voyage, a group of sailors who love graffiti painted a pirate image on the chimney, and actually raised a pirate flag on the mast of the ship to commemorate the pirate “Captain Kidd” of the same name. “Captain Kidd” was a famous pirate at the end of the 17th century and a household name in Europe and America.
Fortunately, this pirate logo was recognized and endorsed by the widow of the captain of USS Arizona. The U.S. Navy also acquiesced to this practice and announced that "USS Kidd" was the only destroyer capable of flying the pirate flag at the time. Today, the active-duty Arleigh Burke-class destroyer "USS Kidd" (DDG-100) can still fly the pirate flag, and the "Line-crossing Ceremony" has also been revived within the U.S. Navy, and other warships can also join in the fun.
Overall, there is nothing malicious about hoisting a pirate flag on the ship, it is just a custom of European and American naval culture. On the one hand, it is to alert the crew that sailing on the sea is facing challenges and dangers everywhere; on the other hand, the purpose of hoisting the pirate flag is to inspire the crew to face challenges and difficulties bravely, and have a "pirate spirit" that is not afraid of difficulties and dangers.