Another interesting example of people embracing the pirate image was British submarines in WW1. The First Sea Lord of the day saw them as ungentlemanly and called for all German submarine crews to be hanged as pirates, this outburst birthed the tradition that a British submarine returning home after successfully sinking an enemy vessel flies the jolly roger! The last time this occurred was after the 1982 Falklands War, I believe HMS Conqueror to this day remains the only nuclear submarine to have engaged an enemy ship with torpedos.
pirate (n.)
Meaning "one who takes another's work without permission" first recorded 1701; sense of "unlicensed radio broadcaster" (generally transmitting from a ship outside territorial waters) is from 1913.
pirate (v.)
"to rob on the high seas; commit piracy upon," 1570s, from pirate (n.). By 1706 as "appropriate and reproduce the literary or artistic work of another without right or permission; infringe on the copyright of another."
-- https://www.etymonline.com/word/pirate
sadly it doesn't explain the how of the word coming about.
"The term "piracy" is used by record companies to demonize sharing and cooperation by equating them to kidnaping, murder and theft." [0]
(Better read it in entirety, if you haven't yet)
Literal pirate parties exist in Somali and prey on nearby shipping lanes.
Torrenting non-free products from unofficial sources is illegal.