To refer to someone as “a piece of work” is to speak disparagingly of them. “What a piece of work!” one may exclaim, or “he’s a real piece of work.” It’s usually said in response to that person having done something specific. It sometimes has an adjective in front of it to emphasise the negativity, such as “a nasty piece of work,’ or “real,’ as in the example above, but a simple “a piece of work” conveys the same message and has become idiomatic in that form.
The phrase is lifted from Shakespeare’s Hamlet, Act 2 scene 2. Hamlet’s fellow students, Rosencrantz and Guildenstern, are visiting Denmark. Hamlet is in a depressed state, and at this stage of the play he is quite sick of having to be with people, and doesn’t think much of them. He expresses this to the visitors. He tells them that he is struck by what a wonderful creation human beings are – how perfect they are in their bodies and minds – the most beautiful creatures in the world, so far above other animals – and yet, at the end of the day, they are nothing but dust. They are worthless. Moreover, this beautiful world, beneath a blue sky and golden sun, is nothing but a foul, stinking barren rock.
“… this goodly frame the earth, seems to me a sterile promontory; this most excellent canopy the air, look you, this brave o’er hanging firmament, this majestical roof, fretted with golden fire: why, it appeareth no other thing to me, than a foul and pestilent congregation of vapours. What a piece of work is man, how noble in reason, how infinite in faculty, in form and moving how express and admirable, in action how like an Angel, in apprehension how like a god, the beauty of the world, the paragon of animals. And yet to me, what is this quintessence of dust? Man delights not me…”
In its original Shakespearean context “a piece of work” simply means something made by someone – in this case, human beings created by God, in the sense of having been manufactured. Hamlet is comparing human beings with angels. Made of dust human beings are miraculous creations, having the nobility of mind that an angel has, the beautiful physical form that an angel has, and with the understanding of a god. There is a sense that it is a tragedy, as in spite of being so god-like, human beings are worthless.
Around the beginning of the twentieth century the term, “piece of work,” qualified by “nasty” or “real,” was used in Britain as meaning someone difficult to deal with. Around the second half of the century the term emerged in America without the epithets, “nasty” or “real,” to mean a nasty person. It was then used in that way, simply as “a piece of work,” and from the United States, it migrated back to Britain and other English speaking countries, used in the American way. And that’s how it currently stands – as an established idiom “a piece of work,’ meaning someone disreputable. It has drifted far from the original Shakespearean meaning, as human beings being compared with angels, and now it has nothing to do with angels.
In the second Die Hard movie, one of the villains is called “a piece of work” by his compatriot and it is meant as a compliment, so I think nowadays the meaning has some stretch in it.