It typically contains an antihistamine, a cough suppressant, and a pain reliever/fever reducer.
Many OTC cold and cough syrups and cough medicines contain a cough suppressant (dextromethorphan) plus an expectorant (guaifenesin) along with other cold medicines and pain relievers.
Read the label of any other medicine you are using to see if it contains a cough suppressant.
Nyquil Cough contains a cough suppressant and antihistamine but no painkiller.
I do not know what cold medicine you took, or if that medicine contained a cough suppressant.
This product also contains a narcotic cough suppressant (antitussive) that affects a certain part of the brain, reducing the urge to cough.