c. 1300, "dig in the ground," from hypothetical Old English *grybban, *grubbian, from West Germanic *grubbjan (source also of Middle Dutch grobben, Old High German grubilon "to dig, search," German grübeln "to meditate, ponder"), from PIE *ghrebh- (2) "to dig, bury, scratch" (see grave (n.)). Transitive sense "dig up by the roots" is from 1550s. Related: Grubbed; grubbing.
"larva of an insect," early 15c., perhaps from grub (v.) on the notion of "digging insect," or from the possibly unrelated Middle English grub "dwarfish fellow" (c. 1400). Meaning "dull drudge" is 1650s. The slang sense of "food" is first recorded 1650s, said to be from birds eating grubs, but also often linked with bub "drink."