"palm tree," 1550s, from Spanish and Portuguese coco "grinning or grimacing face," on resemblance of the three depressions at the base of the shell to a monkey or human face. The earlier word for it was the Latinized form cocus, which sometimes was Englished as cocos.
"to beat up," 1818, originally "to strike the face" (in pugilism), from mug (n.2) "face." The general meaning "attack" is attested by 1846, and "attack to rob" by 1864. Perhaps influenced by thieves' slang mug "dupe, fool, sucker" (1851). Related: Mugged; mugging.
"small make-up case," 1919, from compact (adj.), based on its containing compacted face powder.