Old English stocc "stump, post, stake, tree trunk, log," also "pillory" (usually plural, stocks), from Proto-Germanic *stauk- "tree trunk" (source also of Old Norse stokkr "block of wood, trunk of a tree," Old Saxon, Old Frisian stok, Middle Dutch stoc "tree trunk, stump," Dutch stok "stick, cane," Old High German stoc "tree trunk, stick," German Stock "stick, cane;" also Dutch stuk, German Stück "piece"), from an extended form of PIE root *(s)teu- (1) "to push, stick, knock, beat" (see steep (adj.)).
Meaning "ancestry, family" (late 14c.) is a figurative use of the "tree trunk" sense (as in family tree). This is also the root of the meaning "heavy part of a tool," and "part of a rifle held against the shoulder" (1540s). Meaning "person as dull and senseless as a block or log" is from c. 1300; hence "a dull recipient of action or notice" (1540s).
Meaning "framework on which a boat was constructed" (early 15c.) led to figurative phrase on stocks "planned and commenced" (1660s). Taking stock "making an inventory" is attested from 1736. Stock, lock, and barrel "the whole of a thing" is recorded from 1817. Stock-still (late 15c.) is literally "as still as a tree trunk."