"small, enclosed space," 1825, the first element possibly from a diminutive of cub "stall, pen, cattle shed, coop, hutch" (1540s), a dialect word with apparent cognates in Low German (such as East Frisian kubbing, Dutch kub). Or perhaps it is related to cuddy "small room, cupboard" (1793), originally "small cabin in a boat" (1650s), from Dutch kajuit, from French cahute. OED calls it "a nursery or children's name."
Others are reading
<a href="https://www.etymonline.com/word/cubby">Etymology of cubby by etymonline</a>
Harper, D. (n.d.). Etymology of cubby. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/cubby