*Historically* it referred specifically to an effigy of Guido "Gunpowder Plot" Fawkes. The change to mean first "poorly dressed man" and then "any male of equal or lower status (informal)" is part of the efflorescence of new language that emanated from the US in the first half of the 19th century: it is still seen as an Americanism by many people in the UK. The change to mean "anyone of any gender (informal)" is still ongoing and is not complete.
So this is a word that jumped from Italian to French to English to American English, shifting meanings all along the way, from a proper name to an epithet to a description of a thing to a description of different classes of people, and now is making its way back into British English again... all in the last 500-odd years.
(In the UK the tradition of burning effigies on bonfires on Bonfire Night persists, though generally they are not effigies of the Pope anymore, that's just tacky and insensitive. Instead we have effigies of, well, everything you can imagine! The local bonfire had *43* effigies on it, one per scout troop involved, most buried deep inside because there were far too many to fit on top, but one of the ones on top was a sea serpent. My favourite effigy of the last few years has to have been one from last year, an absolutely perfect, instantly recognizable Spitting-Image-style parody of Rupert Murdoch...)