The Oxford English Dictionary states that the origin of the current usage is unknown. There are two usually suggested possible origins: an earlier usage of gook, meaning prostitute; or goo-goo (also gugu), a term used by the US military to describe Filipinos. The prostitute usage is recorded in a slang dictionary published in 1893, which defined gook as "a low prostitute"; a similar meaning was recorded for gooh in 1859. This later came to imply a foolish or peculiar person. The goo-goo term, whose origins are similarly uncertain, was first used in 1899 by US troops in the Philippine–American War, although nigger was more prevalent.
Mencken reports the earliest use of the word gook: he wrote that US marines occupying Nicaragua in 1912 took to calling the natives gooks and that it had previously been a term for Filipinos. He further mentions that the natives of Costa Rica are sometimes called goo-goos. The first written use was in 1920 and mentions that the marines occupying Haiti used the term to refer to Haitians. US occupation troops in Korea after World War II called the Korans "gooks". Although mainly used to describe non-European foreigners, especially Asians, it has been used to describe foreigners in general, including Italians in 1944, Indians, Lebanese and Turks in the '70s, and Arabs in 1988.
It has been suggested that gook comes from the Korean word "국" (guk), meaning "country", "한국" (hanguk), meaning "Korea", or "미국" (miguk), meaning "America". For example, American soldiers might have heard locals saying miguk, referring to Americans, and misinterpreted this as "Me gook." These etymologies ignore the fact that there are many examples of the word's use that before the 1950s. So prevalent was the use of the word gook during the first months of the Korean War that US General Douglas MacArthur banned its use, for fear that Asians would become alienated to the United Nations Command because of the insult.
The term has been used by non-US militaries, notably the Rhodesian forces during the Rhodesian Bush War, where it was used interchangeably with terr to described the guerrillas, and by Australian forces during the Vietnam War.
In modern US usage, "gook" refers particularly to Communist soldiers during the Vietnam War. It is generally considered highly offensive. In a highly publicized incident, Senator John McCain used the word during the 2008 presidential campaign to refer to his former captors, then apologized to the Vietnamese community at large. "I hate the gooks. I will hate them as long as I live… I was referring to my prison guards and I will continue to refer to them in language that might offend." It was used in numerous movies and books depicting the Vietnam War.[nb 1]
1893 Slang and its Analogues. "GOOK, subs. (American). A low prostitute. For synonyms, see BARRACK HACK and TART."
1920 The Nation (magazine). The Haitians in whose service United States marines are presumably restoring peace and order in Haiti are nicknamed "Gooks".
1950 The Kansas City Star. "General MacArthur’s headquarters frowns on the practice of calling North Koreans "gooks." An article in the official magazine Tips says the person who uses the word is unwittingly guilty of giving aid and comfort to the enemy."
1960 Dictionary of American Slang. gook: Generically, a native of the Pacific islands, Africa, Japan, China, Korea or any European country except England; usually a brown-skinned or Oriental non-Christian.
2000 John McCain. Referred to his Vietnamese wartime experience, “I hate the gooks. I will hate them as long as I live… I was referring to my prison guards and I will continue to refer to them in language that might offend.”