In the song “Yankee Doodle,” why did Yankee Doodle stick a feather in his cap and call it Macaroni?

The line refers not to the pasta but to the Macaroni Club, a mid-eighteenth-century English social club of dandyish young men who wanted to bring the influences of the Continent to bear on their home country.

Thus the line was originally intended to discredit American revolutionaries.