c. 1300, "pile, heap, or group of things," from a Scandinavian source akin to Old Norse stakkr "haystack" (cognate with Danish stak, Swedish stack "heap, stack"), from Proto-Germanic *stakon- "a stake," from PIE *stog- (source also of Old Church Slavonic stogu "heap," Russian stog "haystack," Lithuanian stokas "pillar"), variant of root *steg- (1) "pole, stick" (see stake (n.)). Meaning "set of shelves on which books are set out" is from 1879. Used of the chimneys of factories, locomotives, etc., since 1825. Of computer data from 1960.
early 14c., "to pile up (grain) into a stack," from stack (n.). Meaning "arrange (a deck of cards) unfairly" (in stack the deck) is first recorded 1825. Stack up "compare against" is 1903, from notion of piles of poker chips (1896). Of aircraft waiting to land, from 1941. Related: Stacked; Stacking.