Interestingly (?) that word originally (in 1899) referred to Filipinos. It has shifted its use over the decades, moving from a slur for this Asian group to that Asian group (and to Nicaraguans!).
It’s only a coincidence that it resembles that Korean word, kuk (국).