Where does this word come from? I have a weird feeling it's an insulting reference to Hungary (Magyar?)
In short, nobody knows.
It's a Balkan word with disputed etymology: Bulgarian and Macedonian магаре (magare); Serbian and Croatian magarac (магарац); Romanian măgar; Albanian magar. It is usually compared to the Greek γομάρι and the Albanian gomar (from Greek), both meaning “donkey” and thought to come from the Greek γομάριον (a pack animal), γόμος (load, burden), or as a borrowing from Arabic ḥimār (donkey). All these forms, however, do not explain the vowels in the various South Slavic languages and Romanian. The lack of old forms makes it difficult to find a proper etymology for the word, so it may somehow come from Paleo-Balkan languages, (Vulgar) Latin, or you may actually be correct in your assertion and it could potentially be connected to Hungarians in some way, either derogatory or otherwise, – we simply have no idea, more or less.
Smarinov: One mistake in your writing - the Slovenian word for "donkey" is "osel", not "magarac"!!
Thanks, I didn't know that! I fixed it above and sent feedback to the authors of the source I used.
This is an old Slavic (and actually Indo-European) word for donkeys and осел is used in Bulgarian alongside магаре (also osioł in Polish and osel in Czech, асёл in Belarusian and осёл in Russian, Esel in German, even aasi in Finnish and asinus in Latin, etc).
To be safe, not a good idea! Just as in English and other Indo-European languages, people compared to donkeys are percieved as strongheaded at best! BUT, to make the OP and the friendly neighbors (the Hungarians) feel better, apparently (see reference below) there are areas in Romania where ”măgăreț” means ”funny” as in amusing or witty. See: http://www.webdex.ro/online/dictionar/m%C4%83gar
It's an insulting in romanian if you say to a man. Esti un magar! - You are a jerk!
Magyar is of native origin and has never been pronounced with proper -g- (it comes from proto-Ugric *mænć- /a thinking creature/ pronounced with an affricate, not a stop; PS: the affricate -nć- eventually became voiced -ǯ- because of the nasal - this is a regular sound change in Hungarian). Thus, it's very unlikely that the name of the animal comes from the endonym of the Hungarians.
There is a possibility to come from the Dacian language (they used to live on the Romanian territory before the Romans came) , https://ro.wikipedia.org/wiki/Listă_de_cuvinte_românești_moștenite_probabil_din_limba_dacă
It seems odd that an animal might be named after a culture, even as an insult. Presumably, the culture would be called after the animal. We might learn more from the etymlogy of Magyar. Regardless, if Magyar is the name Hungarians use to describe their own country, I'm assuming they aren't making fun of themselves.
As a native speaker of American English, I often confuse the r- and l-sounds of romance languages. I heard that at a young age, our brains are wired to turn sounds into discrete phonemes, and its very hard to for me to unhear the English letters. I even hear an English sound for â, although I've been told that's not available in English.