late Old English cnafa "boy, male child; male servant," from Proto-Germanic *knabon- (source also of Old High German knabo "boy, youth, servant," German knabe "boy, lad"); it is also probably related to Old English cnapa "boy, youth, servant," Old Norse knapi "servant boy," Dutch knaap "a youth, servant," Middle High German knappe "a young squire," German Knappe "squire, shield-bearer." Original sense unknown; Klein suggests the prehistoric meaning might have been "stick, piece of wood." For pronunciation, see kn-.
Sense of "rogue, rascal" is first recorded c. 1200, presumably via sense evolution from "a menial" to "one of low birth," and the low character supposed to be characteristic of such a condition. But through Middle English it kept also its non-pejorative meaning, as in knave-child (Scottish knave-bairn) "male child." In playing cards, "the lowest court card," 1560s.
Previously, the English equivalent of the French valet was normally known as Knave, in the sense of 'serving-lad'. In the seventeenth century it came to be called Jack, from the name properly applied to the Knave of trumps at All Fours. All Fours being a low-class game, the use of 'Jack' for 'Knave' was long considered vulgar. ('He calls the Knaves Jacks!', remarks Estella contemptuously in Dickens's Great Expectations.) When indices came in, it was obviously preferable to use 'J' rather than 'Kn' to avoid confusion with 'K' for King. Jack has since become the normal title of the lowest court, though 'Knave' can still be heard. [David Parlett, "A History of Card Games," 1991]