The British soldiers made up a song that they thought would be insulting to the colonists. Instead the colonists loved it so much they began to sing it all the time.
The definition of a "macaroni" as used in this song was a "fashionable fellow". The British were making fun of the colonists lack of uniforms and rough clothing.
All over the colonies, patriots made up verses to go with the tune. This song was known as Yankee Doodle Dandy.
Yankee Doodle went to town
A-riding on a pony,
Stuck a feather in his cap
And called it macaroni