If you take any kind of medication, either prescription or over-the-counter, chances are your drug has at least three different names. It will have a brand name, a generic name and a chemical name. If water were a drug, its three names might be 'Refresh', 'water' (some names are grandfathered in), and 'dihydrogen monoxide'. The latter two names must follow strict naming conventions.
Taking them in reverse order, the chemical name is decided on by the International Union of Pure & Applied Chemistry (IUPAC). This name specifies the chemical nature of the active ingredient—that is, the composition of the actual molecule. Unless you were a chemist, and probably not even then, you would have no idea what a drug did based on this name. For example, can you guess what you’d take (RS)-2-(4-(2methylpropyl)phenyl)propanoic acid for? If you said fever and aches, you’d be right, because it’s the IUPAC name of ibuprofin (Motrin or Advil).
The generic name of a drug, which must be approved by the United States Adopted Name (USAN) Council, is chosen not just for its physical structure, but also for its physiological function. The USAN keeps a list of word stems that can be strung together to create each new drug name. If you consulted this list, you might be able to figure out what the drug would be used for. You could see that pantoprazole contains the suffix ‘prazole’ which indicates that it’s an anti-ulcer agent. And in fact, pantoprazole is the generic name of a drug used to treat gastroesophageal reflux disease.
Finally, the brand name is selected by the pharmaceutical company that invented the drug. This choice is often a matter of market research.