This dates back to at least the 18th century, when actual pirates were still a real problem to plenty of English speakers. So who first used this metaphor? Was it seen as excessive of exaggerated at the time?
The term "pirate" has long been used in a very broad sense for a private, illegal activity. "Pirate buses" existed in the 19th century (illegal, unlicensed, privately-run buses), and "pirate radio" in the 20th. The analogy here is about "literary piracy" or "print piracy." The terminology in English came shortly after stories of pirates were becoming quite famous, and was applied broadly to many areas of illegal and unsanctioned activity. In the case of its earliest uses (print and pharmaceuticals, i.e. "patent medicines" and their counterfeiting) it was meant to imply that the "pirates" (who were the producers of counterfeit products, not the consumers of them like we think of it today with regards to the Internet) were outsiders to the correct social order, an order that needed to be defended.
And it should be noted: the question to ask here is when the term copyright became known. Because that was the late-comer, it is a response to piracy, an establishment of a legal right where one did not exist previously, and did not show up until the late 1730s. Intellectual property was a legal invention meant to "protect" printers and authors against piracy.
A great book on the subject: Adrian Johns, Piracy: The Intellectual Property Wars from Gutenberg to Gates (University of Chicago Press, 2009), esp. chapter 3 for the early history of the term.