Old English bolt "short, stout arrow with a heavy head;" also "crossbow for throwing bolts," from Proto-Germanic *bultas (source also of Old Norse bolti, Danish bolt, Dutch bout, German Bolzen), perhaps originally "arrow, missile," and from PIE *bheld- "to knock, strike" (source also of Lithuanian beldžiu "I knock," baldas "pole for striking").
Applied since Middle English to other short metal rods (especially those with knobbed ends): meanings "stout pin for fastening objects together" and "part of a lock which springs out" are both from c. 1400. A bolt of canvas (c. 1400) was so called for its shape. Adverbial phrase bolt upright (like a bolt or arrow) is from late 14c. Meaning "sliding metal rod that thrusts the cartridge into the chamber of a firearm" is from 1859. From the notion of an arrow's flight comes the bolt of lightning (1530s) and the sense of "a sudden spring or start" (1540s).