mid-15c., "bedroom, bedchamber," from Latin cubiculum "bedroom," from cubare "to lie down," which is perhaps from a PIE *kub-, with cognates in Middle Welsh kyscu, Middle Cornish koska, Middle Breton cousquet "to sleep," but de Vaan regards the PIE origin of the Latin word as "uncertain." Compare cubit.
Obsolete from 16c. but revived by 1858 for "dormitory sleeping compartment," especially in an English public school. The sense of "any partitioned space" (such as a library carrel or, later, office work station) is attested by 1926. Related: Cubicular.