Are you asking how we discovered medical chemistry?
In ancient times people already knew that certain plants had medicinal or psychoactive properties simply from generations of trial and error. This root makes headaches go away. This flower makes them worse.
In an effort to increase the effectiveness or mitigate side effects, people experimented with boiling, cooking, drying… all sorts of rudimentary processing steps to concentrate or deactivate certain active ingredients. They didn’t necessarily know exactly what was happening on a chemical level, but they understood that they were concentrating some sort of “essence” of the material.
So it’s no big leap of logic to toss some solvents at a cocoa leaf to t try and extract the stimulant chemical that gets people wired. Eventually you get a perfected process down to isolate pure cocaine and *really* get wired.
Latest Answers