In 1897 Bayer chemist Felix Hoffmann acetylated salicylic acid (SA) to make aspirin as his father and many other complained of the bitter taste and side effects of SA to treat arthritis.
The dried latex from poppy plants is 10% morphine. That same year Hoffman also acetylated morphine in two places to form a substance which Bayer trademarked as "heroin" (German for heroic/strong) since it was more than twice as potent as morphine.
Bayer marked heroin as a cough suppressant for a number of years.
Acetylation involves the attached of an acetyl -C(=O)CH3 group to the oxygen of an hydroxyl (-OH) functional group and can be done with acetic acid or acetic anhydride. There is one hydroxyl group in SA and two hydroxyl groups in morphine as can be seen in the structures below.