Dopamine is used for a wide variety of things in the human body, such as motor control, cognitive function, pleasure/reward, hormone control, ECT.
The subtype of dopamine D2 is located in the chemoreceptor trigger zone, often released from nerve endings in the GI tract. GI irritation releases dopamine and serotonin neurotransmitters, which in turn causes the nausea and vomiting. Dopamine blockers prevent that irritation from happening.