"a gentile, a non-Jew" (plural goyim), 1835, from Hebrew goy "people, nation;" in Mishnaic and Modern Hebrew, also "gentile" (compare gentile). The fem. form of the Hebrew word entered French as gouge "a wench" (15c.).
"long, tedious, complicated story," by 1905, from Yiddish Megillah (as in a gantse Megillah "a whole megillah"), literally "roll, scroll," collective name of the five Old Testament books appointed to be read on certain feast days, from Hebrew meghillah, from galal "he rolled, unfolded." The slang use is in reference to the length of the text. The use of the word in English in reference to the holy books is from 1650s.
Jonas used to laugh. "What do I care for the Goyim," he said, but Isaac was different. He would talk thee a Megillah about Equality and Brotherhood,—one would have thought, he was reading something aloud out of the newspaper,—and what he meant was that the Yüd and the Goy were now alike. [Martha Wolfenstein, "A Renegade," Philadelphia: Jewish Publication Society of America, 1905]
"one who is not a Jew," c. 1400; earlier "one who is not a Christian, a pagan" (late 14c.), from Late Latin noun use of Latin gentilis "of the same family or clan, of or belonging to a Roman gens," from gens (genitive gentis) "race, clan," from PIE root *gene- "give birth, beget," with derivatives referring to procreation and familial and tribal groups. Compare gentle.
The Latin adjective also meant "of or belonging to the same nation," hence, as a noun, gentiles (plural) might mean "men of family; persons belonging to the same family; fellow countrymen, kinsmen," but also "foreigners, barbarians" (as opposed to Romans), those bound only by the Jus Gentium, the "law of nations," defined as "the law that natural reason establishes among all mankind and is followed by all peoples alike."
The Latin word then was used in the Vulgate to translate Greek ethnikos (see ethnic), from ta ethne "the nations," which translated Hebrew ha goyim "the (non-Jewish) nations" (see goy). Hence in Late Latin, after the Christianization of Rome, gentilis also could mean "pagans, heathens," as opposed to Christians. Based on Scripture, gentile also was used by Mormons (1847) and Shakers (1857) to refer to those not of their profession.
late 15c. (earlier ethnical, early 15c.) "pagan, heathen," from Late Latin ethnicus, from Greek ethnikos "of or for a nation, national," by some writers (Polybius, etc.) "adopted to the genius or customs of a people, peculiar to a people," and among the grammarians "suited to the manners or language of foreigners," from ethnos "band of people living together, nation, people, tribe, caste," also used of swarms or flocks of animals, properly "people of one's own kind," from PIE *swedh-no-, suffixed form of root *s(w)e-, third person pronoun and reflexive, also forming words referring to the social group (see idiom). Earlier in English as a noun, "a heathen, pagan, one who is not a Christian or Jew" (c. 1400). In modern noun use, "member of an ethnic group," from 1945.
In Septuagint, Greek ta ethne translates Hebrew goyim, plural of goy "nation," especially of non-Israelites, hence especially "gentile nation, foreign nation not worshipping the true God" (see goy), and ethnikos is used by ecclesiastical writers in a sense of "savoring of the nature of pagans, alien to the worship of the true God," and as a noun "the pagan, the gentile." The classical sense of "peculiar to a race or nation" in English is attested from 1851, a return to the word's original meaning; that of "different cultural groups" is 1935; and that of "racial, cultural or national minority group" is American English 1945. Ethnic cleansing is attested from 1991.
Although the term 'ethnic cleansing' has come into English usage only recently, its verbal correlates in Czech, French, German, and Polish go back much further. [Jerry Z. Muller, "Us and Them: The Enduring Power of Ethnic Nationalism," Foreign Affairs, March/April 2008]