To non-Americans, a Yankee is an American and can be a derogatory term. To western Americans it can be anyone from east of the Mississippi. To southerners, a Yankee is someone from north of the Potomac. North of the Potomac, it’s someone from east of the Hudson, which gets to the original use of the word, meaning, generally, someone from New England. For New Englanders it becomes more complicated.
Among New Englanders, an authentic Yankee may more strictly refer to old-stock New Englanders of English descent, and among old-stock New Englanders it can mean chiefly one who eats pie for breakfast. (Apple or blueberry.)
No one disagrees that the term Yankee includes anyone from Maine. To Mainers, Connecticut may not be authentic Yankee territory, although “Yankee Doodle” is Connecticut’s state song. (Do they need one?) And while northern New Englanders may question whether Connecticut is Yankee enough, members of a certain New York City baseball team are bona fide Yankees, which raises mixed emotions because that makes the Yankees the main rival of the Boston team, who might have copped the name, Yankees, if they hadn’t been contemplating their footwear.
When a Yankee (other than a baseball Yankee) is beyond his borders, so to speak, he risks the handle, damn(ed) Yankee. While to southerners a Yankee is anyone in their midst from the north, a damn Yankee is one who doesn’t show any signs of going back where he belongs.
Linguists do not agree on the origins of the word, although there are a couple of compelling possibilities. See the article at Wikipedia for more details.
As for me, I am, in a way, the opposite of the original damn Yankee. I was born in the Deep South and came north over 50 years ago to stay… I’m a damn Yankee by choice. With ancestry in Maine I’ve been adopted by the state and have adapted to it.