From Online Etymology:
1683, a name applied disparagingly by Du. settlers in New Amsterdam (New York) to English colonists in neighboring Connecticut. It may be from Du. Janke, lit. "Little John," dim. of common personal name Jan; or it may be from Jan Kes familiar form of "John Cornelius," or perhaps an alt. of Jan Kees, dial. variant of Jan Kaas, lit. "John Cheese," the generic nickname the Flemings used for Dutchmen. It originally seems to have been applied insultingly to Dutch, especially freebooters, before they turned around and slapped it on the English. In Eng. a term of contempt (1750s) before its use as a general term for "native of New England" (1765); during the American Revolution it became a disparaging British word for all American native or inhabitants. Shortened form Yank in reference to "an American" first recorded 1778.
Wikipedia entry too long to include: