A jackanapes is a cheeky or impertinent person.
The most widespread story connects the origins of this word with William de la Pole, Duke of Suffolk. He was steward of the Royal Household under Henry VI, but was accused of treason and banished in 1450, only to be murdered at sea off Dover. His emblem was an ape’s clog and chain (a clog here being not a type of shoe but a heavy block of wood to stop the animal escaping). This led to his being described in a scurrilous poem the year before his death as ape-clog and posthumously as Jack Napes.
Though Jack Napes might therefore seem to derive from the ill-fated duke, something that has often been assumed, the experts are sure that it came from another source and was applied to the Duke because of his odd emblem. The real origin probably lay in a playful name for a tame ape, in which the second part was a case of metanalysis (in which an ape has been turned into a nape), with an s on the end to make it match other surnames of the period, like Jacques or Hobbes.
It went through various forms until it settled down to its modern spelling. The idea behind it moved from a pet name for an ape to a man acting in some way like an ape. The OED gives the sense in one of its wonderful definitions as “One who is like an ape in tricks, airs, or behaviour; a ridiculous upstart; a pert, impertinent fellow, who assumes ridiculous airs; a coxcomb.”