Narcotic originally had a narrow meaning, referring to a class of drugs, but its meaning has changed over the decades. It is now so imprecise that authorities in the medical field as well as law enforcement and the justice system typically do not use the term.
The word comes from the ancient Greek for stupor and is related to sleep words such as narcolepsy (disorder in which subject falls asleep at inappropriate times) and narcosis (fancy word for sleep). The ancients were familiar with plant-derived medicines that put people into a stupor. The most extreme was opium, derived from the poppy plant and smoked from ancient times.
In the 19th Century chemists were able to refine morphine from poppies and doctors started using it as an anesthetic and to relieve pain. Semi-synthetic opiates such as heroin and hydrocodone were also developed. In addition to medical uses, these drugs often were abused and were very addictive, so laws to severely restrict their manufacture and use were passed. The laws sometimes referred to different classes of drugs under the umbrella term narcotic. For instance, the U.S. Controlled Substances Act definition of narcotic includes cocaine, which is a major stimulant and has opposite behavioral properties from opiates. Barbituates and amphetamines were also sometimes called narcotics. In the case of barbiturates, which are depressants, there is some justification for this usage.
The word “narc” referred to a law officer specializing in drug crimes and the verb “to narc” came to mean to report offences to the authorities. In current usage, narcotic can refer to an opiate, to every addictive substance, and even to every psychoactive substance. The word has become so imprecise that it is never used in medical journals anymore or nearly as much in law enforcement as it used to be (where the even less precise term “drugs” now covers all banned medicines and drugs.)
You even see television advertisements for prescription sleeping pills that tout “it’s non-nacrotic”, which is a little disingenuous as it implies that other common sleeping pills used in recent decades are narcotics. No common drug prescribed by doctors these days for insomnia only is a true narcotic. (Doctors continue to use opiates in selected cases, but not for sleeplessness.)
The word “hynotic” continues to be used and is better for describing sleep aid medications commonly used.