Left radical 木, a tree with branches and roots, marking 柜 as a wooden object. It joins the large furniture-and-timber family: 桌, 椅, 柱, 床. A cabinet or counter was a wooden construction by default in classical Chinese.
Right phonetic 巨 supplies the sound (a related older velar reading behind guì). 巨 also pictures a carpenter's measuring square, adding a faint 'large built thing' flavour fitting a sturdy cabinet. Compare 距, which uses the same phonetic.