This was during 1899, when the US marine who were sent to suppressing the Filipino insurgent and upraising; because of the foreign sound of Filipino language to these US marine, they start calling Filipino as Goo-Goo Eyes based on the Goo-Goo Tribes.
Later the term is shorten to Gook!
During Korean War and Vietnam War; both of these Korean and Vietnamese enemies were called Gooks.