in the song yankee doodle dandy, 'macaroni' was a slang term denoting a man who dressed effeminately. the melody predates the current song by at least 3 centuries, and was popular across europe and scandinavia.

the modern lyrics were meant to be a slur on american soldiers by the british troops, but the american militia adopted the song. it has been a patriotic song ever since.