the online dictionary of etymology says that "gook first pops up in 1899, U.S. military slang for "Filipino" during the insurrection there, probably from a native word, or imitative of the babbling sound of their language to American ears (cf. barbarian). The term goo-goo eyes "soft, seductive eyes" was in vogue c.1900 and may have contributed to this somehow."
however, this is debated historically. it certainly returned to currency, and i guess, as this is not scientific, took on its more familiar term for asians in general during the korean conflict. the word in hanguel 국 (pronounced 'gug' 'guk' or 'gook') means person/native things along those lines. as an american i am a 미국 or 'me gook' (humorously enough). it seems likely that during the korean conflict that beyond 미국 americans heard 한국 'han gook' which means korean and also 외국 'way gook' or foreigner. hearing all these 국 why wouldn't americans just start calling their koreans enemys (and i imagine their allies) 'gooks'. you take this one step further, when in viet nam some of the higher ups have experience in korea and are influencing the soldiers already in or headed to viet nam, and the sticking power of 'gook' becomes complete.
the first time i heard all this 국 talk from koreans, this was my immediate hunch, so i am sticking with it--not that it is a revolutionary thought, and i know there is some on-line documentation that supports my thinking, i just thought i would type about it here in case some of you didn't every google 'gook etymology' on your own. also, i couldn't help but laugh as all of my knowledge of 'gook' comes from viet nam (vietnam being another example of bastardized language) movies.
if anyone has more solid information, please leave it in the comment box.