Hoist with one’s own petard
This expression means to fall foul of one’s own bad intentions towards others. It was coined by Shakespeare in Hamlet, Act III, Scene IV, “For ‘tis the sport to have the engineer hoist with his own petard.” Hoist is the past participle of the archaic verb hoise, which means to raise or elevate. A petard, now obsolete, was a primitive bomb, which was used to breach city or castle walls. Thus, in Shakespeare’s use, the engineer was blown up with his bomb and it was not long after this that its figurative meaning became entrenched.