c.1610, "younger son or brother," from French cadet "military student officer," noun use of adjective, "younger" (15c.), from Gascon capdet "captain, chief, youth of a noble family," from Late Latin capitellum, literally "little chief," hence, "inferior head of a family," diminutive of Latin caput "head" (see capitulum). "The eldest son being regarded as the first head of the family, the second son the cadet, or little head" [Kitchin].
Apparently younger sons from Gascon noble families were sent to French court to serve as officers, which gave the word its military meaning. In English, the meaning "gentleman entering the military as a profession" is from 1650s, and that of "student at a military college" is from 1775.