If this sounds as though it is connected with Italian pasta, you’re right. It was coined in the sixteenth century by the Italian poet Teofilo Folengo, in reference to a sort of burlesque verse he invented in which Italian words were mixed in with Latin ones for comic effect.
He said that he linked the crude hotch-potch of language in the verse with the homely foodstuff called macaroni, a dish which he described (in Latin, of course) as “pulmentum farina, caseo, botiro compaginatum, grossum, rude, et rusticanum” (“a savoury dish bound together with flour, cheese [and] butter, [a dish] which is fat, coarse, and rustic”).
The word first appeared in English a century later and expanded its scope to refer to any form of verse in which two or more languages were mixed together. A once-famous American example was the mixed German-English verses of Hans Breitmann’s Ballads by Charles Leland, in which a German immigrant is overwhelmed by mid-nineteenth-century America and speaks in a mixture of German and heavily accented English.
Macaronic verse has a link to the eighteenth-century London dandies who were called macaronis because they liked foreign food, Italian in particular, as a result of experiencing it on the Grand Tour. A certain famous old song also contains the word: “Yankee Doodle went to town, / Riding on a pony, / Stuck a feather in his hat, / And called it macaroni”, but that is linked to the dandy sense, not the verse one.