Hash: The hash symbol stems from Roman times when the mark for libra pondo (“pound in weight”) was 'lb', short for libra, and British adopters of the convention put a line across the top to indicate it was a contraction (lb). It’s not entirely clear exactly when it happened but over time, as the symbol was written down more and more quickly, the lb symbol would eventually morphed into a #. This is why the symbol is also known as a “pound sign”. In the 19th century, bookkeeper’s would also use the symbol to denote numbers, e.g. #1 = number one, a convention that has continued to this day, hence why the symbol is also called the “number sign”.
The symbol’s other official technical name is an octothorpe, another contribution to tech etymology by the folks over at Bell Labs (see also Cookie, Grep and Unix). Researchers were developing a new telephone keyboard and wanted buttons that would allow new functions so settled on adding # and * next to zero. They couldn’t call it a ‘pound sign’ because it could be confused with the symbol for British currency, so decided to call it the octothorpe - ‘octo-’ due to it having eight points and ‘-thorpe’, a suggestion by employee Don Macpherson who was part of a group trying to have American Olympian Jim Thorpe's medals reinstated (his two gold medals were stripped from him because it was discovered he had played professional baseball which violated the games’ amateurism rules)
It started to be referred to as a hash from the 1960s, although it has nothing to do with the “hashish” or “hash” that was being smoked at the time (from the Arabic ‘ḥašīš’ meaning “hay, dried herb”). The Oxford English Dictionary believes hash’s etymology is a clipping of ‘hash mark’, the stripe or stripes displayed on the sleeve of a military uniform, which in turn was a compound of ‘hatch’ (to overlay something with narrow strips) and ‘mark’. Hatch is believed to come from the Anglo-Norman and Middle French ‘hacher’ meaning “to chop” (also to cut or engrave lines with a chisel) from Frankish *hakkōn and the Proto-Germanic *hakkōną (“to chop or hack”).
Sources: OED Online | The New Statesman