In the Torah/Hebrew Bible, goy and its variants appear over 550 times in reference toIsraelites and to Gentile nations. The first recorded usage of goy occurs in Genesis10:5 and applies innocuously to non-Israelite nations. The first mention in relation to the Israelites comes in Genesis 12:2, when God promises Abraham that his descendants will form a goy gadol (“great nation”). While the earlier books of the Hebrew Bible often use goy to describe the Israelites, the later ones tend to apply the term to other nations.
Some Bible translations leave the word Goyim untranslated and treat it as the proper name of a country in Genesis 14:1. Bible commentaries suggest that the term may refer to Gutium. The “King of Goyim” was Tidal.
In Rabbinic Judaism
One of the more poetic descriptions of the chosen people in the Old Testament, and popular among Jewish scholarship, as the highest description of themselves: when God proclaims in the holy writ, ‘Goy Ehad B’Aretz’, or ‘a unique nation upon the earth!’.
The Rabbinic literature conceives of the nations (goyim) of the world as numbering seventy, each with a discrete language.
On the verse, “He [God] set the borders of peoples according to the number of theChildren of Israel,” Rashi explains: “Because of the number of the Children of Israel who were destined to come forth from the children of Shem, and to the number of the seventy souls of the Children of Israel who went down to Egypt, He set the ‘borders of peoples’ [to be characterized by] seventy languages.”
The Ohr Hachayim maintains that this is the symbolism behind the Menorah: “The seven candles of the Menorah [in the Holy Temple] correspond to the world’s nations, which number seventy. Each [candle] alludes to ten [nations]. This alludes to the fact that they all shine opposite the western [candle], which corresponds to the Jewish people.”
As noted, in the above-quoted Rabbinical literature the meaning of the word “goy” shifted the Biblical meaning of “a people” which could be applied to the Hebrews/Jews as to others into meaning “a people other than the Jews”. In later generations, a further shift left the word as meaning an individual person who belongs to such a non-Jewish people.
In English, the use of the word goy can be controversial. Like other common (and otherwise innocent) terms, it may be assigned pejoratively to non-Jews. To avoid any perceived offensive connotations, writers may use the English terms “Gentile” or “non-Jew”.
In Yiddish, it is the only proper term for Gentile and many bilingual English and Yiddish speakers use it dispassionately.
A stereotype of a goy, as expressed in Jewish humor, bears derogatory elements, e.g., as Hillel Halkin writes: “A stereotypical goyacts blindly; a stereotypical Jew thinks before acting,”  when commenting on a skit of Jack Benny: when a mugger comes upon him: “your money or your life”, and prods him with the gun, he protests “I’m thinking it over!”
In Israel, secularists rarely use the term, preferring to either refer to foreign countries and nations by their specific names or use such terms as “Ha-Olam Ha-Lo Yehudi” (העולם הלא-יהודי), “The Non-Jewish World”.