I did something really stupid yesterday, and my grandfather told me I was hoist with my own petard." What does that mean? And what's a petard?"
It isn't surprising that you don't hear the word petard tossed about outside of the phrase "hoist with one's own petard" because a petard is a piece of medieval war technology that has long since been made obsolete.
In medieval and Renaissance siege warfare, war engineers would build small gunpowder-filled bombs called petards that they would use to destroy castle walls and gates. To bring down gates, the petards would be designed to explode in one direction, and then hoisted into place against the gate and lit.
If anything went wrong — if the fuse was too short, or the engineer lighting the petard didn't get far enough away, or someone from inside the besieged castle managed hit the petard with a flaming arrow before it was in place — the war engineer could be blown skyward (that is, hoisted) by his own bomb.
Hence, today, if someone tells you that you've been hoist (or hoisted) with your own petard, it means you have fallen into your own trap or harmed yourself in an attempt to harm someone else.
The phrase appears at the end of Act III, Scene 4 of Shakespeare's Hamlet. Speaking of Rosencrantz and Guildenstern's participation in the conspiracy to silence him, Hamlet says:
There's letters seal'd: and my two schoolfellows, -
Whom I will trust as I will adders fang'd, -
They bear the mandate; they must sweep my way
And marshal me to knavery. Let it work;
For 'tis the sport to have the enginer
Hoist with his own petard: and 't shall go hard
But I will delve one yard below their mines
And blow them at the moon . . .
Rosencrantz and Guildenstern are to deliver Hamlet to the King of England with a sealed letter asking the King to kill Hamlet swiftly. When they reach England, though, Hamlet has replaced the letter with one that asks the King to kill Rosencrantz and Guildenstern. When they deliver this letter to the King, they bring about their own demise and are certainly hoisted with their own petard.
One of the interesting things about petard is that it originally comes from a French word meaning "to break wind" . . . in the intestinal sense. Le pétard survives in French today as a word for "firecracker."