In music, # denotes a sharp key or note and b denotes a flat key or note — this is Italian notation.
Traditionally in English, the # symbol was called the hash, because it looked like the end of a cooking implement used to hash vegetables (nowadays everyone would say mash instead).
In US typewriters, there was no £ symbol, so # was used to denote british pounds instead.
When the telephone button pad was created, there was room for two more symbols and tones, so the creators took the asterisk and hash from the typewriter and added them as extra signals.
When Twitter needed a way to denote a tagged word in a tweet, they decided to use the hash symbol.