E. Cobham Brewer 18101897. Dictionary of Phrase and Fable. 1898.
A corruption of English. The word got into general use thus: In 1713 one Jonathan Hastings, a farmer at Cambridge, in New York, used the word as a puffing epithet, meaning genuine, American-made, what cannot be surpassed, etc.; as, a Yankee horse, Yankee cider, and so on. The students of the college, catching up the term, called Hastings Yankee Jonathan. It soon spread, and became the jocose pet name of the New Englander. Since then the term has been extended to any American of the Northern States. (Indian corruption of Anglais or English, thus: Yengees, Yenghis, Yanghis, Yankees.)
Yankee Doodle is Nankee Doodle
(Oliver Cromwell), who went to Oxford with a single feather fastened in a macaroni knot, whence the rhyme
Nankee Doodle came to town upon his little pony,
Stuck a feather in his hat, and called it macaroni.
The brigade under Lord Percy marched out of Boston playing this air by way of contempt, but were told they should dance to it soon in another spirit.