Haha, neither did I actually. I always thought it was a reference to the whole Civil War thing here in America where the Northerners were called Yankees and the Southerners were called Johnny Rebs
I'm pretty sure that the original use stems from the 6 "Yankee" states of New England, around the time Captain Cook was first holidaying in Australia, as a derogatory name used by the English for people from New England, and subsequently the southern states for anybody from the northern states. It is used incorrectly by those outside of America as a name for anybody from the USA as a whole. Those that use it in the belief that they are suggesting a person practices masturbation, as in "what a bunch of yankers", are misguided in their use of the word.