https://www.theatlantic.com/health/archive/2014/09/the-accidental-discovery-of-lsd/379564/
All that 32-year-old Albert Hoffman wanted to do in 1938 was synthesize a chemical compound that would stimulate the respiratory and circulatory systems. He had gone to work for Sandoz, a Swiss chemical company, in 1929, after graduation from the University of Zurich. Sandoz, founded in 1886, had started out manufacturing dyes and, later, saccharin. There wasnt even a formal pharmaceutical department until 1917, when professor Arthur Stoll isolated an active substance called aotamine from ergot, a fungus found in tainted rye that had been used as a folk medicine for generations.
Snip
Hofmann developed a synthetic process to build the ergot compounds from their component chemicals. Using this method, he recreated ergots active ingredients as well as novel but similar compounds that, based on the potency of the ergot compounds, could reasonably be expected to have medical uses.
In a sense Hofmann was playing God, combining lysergic acid with various other organic molecules just to see what happened. He created 24 of these lysergic acid combinations. Then he created the 25th, reacting lysergic acid with diethylamine, a derivative of ammonia. The compound was abbreviated as LSD-25 for the purposes of laboratory testing.