Gook (/ˈɡuːk/ or /ˈɡʊk/) is a derogatory term for Asians which came to prominence in reference to enemy soldiers.[unreliable source?] Originally used to refer to prostitutes, the term was later employed by American soldiers stationed around the world as a pejorative for the native peoples. It acquired its current status as a derogatory word for Asians at the time of the Vietnam War.
A slang dictionary published in 1893 defined "gook" as "a low prostitute". Early usage may have been influenced by the word "mak mak" or "gugu", also applied to Filipinos by the Marines. The term arose from the use of the bark of the gugo tree, which the local women (Filipinas) used to wash their hair (in lieu of shampoo), according to the late David Halberstrom. "The Marines who occupied Nicaragua in 1912 took to calling the natives gooks, one of their names for Filipinos", according to H. L. Mencken. Marines serving in Haiti in 1915 to 1920 used the term to refer to Haitians.
Some scholars suggest that "gook (guk)" refers to the Korean word "한국" (Hanguk) meaning "Korean." However, the word was used before the Korean War. During the Korean War, American soldiers were approached by Koreans who used the term miguk, referring to the Americans, and the American soldiers misinterpreted the term as "Me gook."
In the U.S., "gook" refers most particularly to Communist soldiers in the context of the Vietnam War. It is generally considered highly offensive. In a highly publicized incident, Senator John McCain used the word 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."
1893 Slang and its Analogues, GOOK, subs. (American). A low prostitute. For synonyms, see BARRACK HACK and TART.
1920 The Nation, The Haitians in whose service United States marines are presumably restoring peace and order in Haiti are nicknamed "Gooks"...
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.
1967 Doobie Doo, A gook in the purest sense is anybody what ain’t American.
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.” 
2004 Team America: World Police (movie), "I was so sure the ultimate terrorist was Middle Eastern, but I didn't realize he was a goddamn Gook. I'll never be a racist again."
2008 Gran Torino (movie) Walt Kowalski: "I'm no hero. I was just trying to get that babbling gook off my lawn!"
^For another pre-Vietnam Korean reference, see The Hook (1963).
^ ab"gook Generically, a native of the Pacific islands,Jomak,Africa, Japan, China, Korea or any European country except England; usually a brown-skinned or Oriental non-Christian: 1951 Gook was used during World War 2 at many widely separated stations to refer to natives Word Study May 7/1," (Wentworth, Harold and Stuart Berg Flexner, Dictionary of American Slang, (1960)).
^ abDickson, Paul, War Slang, (2004), p. 29. Dickson cites Mencken's The American Language, Supplement 1 (1945).
^Cao, Lan and Himilce Novas. Everything You Need to Know About Asian-American History. New York :Plume, 1996 "Gook, the American racial epithet for all Asian Americans, is actually the Korean word for 'country.'" Robert G. Lee, Orientals: Asian Americans in Popular Culture (1999) "A bastardization of the Korean "Hanguk" (Korean), or Miguk (American)"