Exactly how much detail do you want?? Sekio explained the basics of how injected drugs get to the brain and then are eliminated from the body.
But if you were looking for more than that, since you asked specifically about heroin:
Heroin is a pro-drug, meaning its effects are mainly caused by other metabolites that the body converts it into, namely 6-MAM and morphine. They are believed to be responsible for heroin's effects, because heroin itself has a relatively low affinity for μ-opioid receptors and has a very short half-life.
When heroin is injected, it avoids first-pass metabolization by the gut/liver (which if taken orally would normally just convert most of it to morphine), since you're putting it straight into the bloodstream, and very rapidly crosses the blood–brain barrier because it is much more fat soluble than morphine itself. Once in the brain, heroin then is converted into the active metabolites 6-MAM (6-monoacetylmorphine) and morphine, and the the weakly active metabolite 3-MAM (3-monoacetylmorphine). Morphine and 6-MAM both bind to μ-opioid receptors. These receptors are not just in the brain, they are also present in the spinal cord, peripheral sensory neurons, and digestive system, so those receptors are responsible for some of heroin's effects as well (constipation anyone?

). Morphine may also bind to δ- and κ-opioid receptors (there is some confusion/controversy about this and these receptors are not believed to play much role in the effects). There is also some evidence that 6-MAM binds to a subtype of μ-opioid receptors that are not activated by morphine itself (it's unclear exactly what these receptors do).
Heroin and its metabolites continue circulating in the bloodstream and go into tissues and organs. 6-MAM continues being converted to morphine or excreted from the body, and then morphine is converted by to inactive metabolites or excreted from the body. So some of it is excreted as heroin, some as 6-MAM, some as morphine, and some as various inactive metabolites. They are all metabolized/excreted at different rates. The perceptible effects end when the levels of the active metabolites in the blood get sufficiently low.
As for what this all means for the effects you feel from heroin:
Soon after injection, there is normally a rush, an "acute transcendent state of euphoria", which occurs while heroin is metabolized into 6-MAM in the brain. There is controversy as to whether it's solely the 6-MAM responsible for the rush or simply the fast onset, going from sober to high in seconds (I personally feel it's both).
Heroin also creates a histamine release, some people claim this is part of what causes the "body high". I'm not entirely sure why this happens but one study suggests that morphine and related drugs/metabolites are "activated into free radicals which produce membrane lipid perturbation and histamine release, causing a massive release of mast cell histamine". Histamine is a compound involved in local immune responses as well as regulating physiological function in the gut and acting as a neurotransmitter. It triggers the inflammatory immune response. Histamine receptors are located in various areas of the body. It's responsible for effects like hives, itching, nausea, and sleep and appetite suppression.
The μ-opioid receptors are the main receptors affected by heroin's active metabolites (morphine and 6-MAM). They are responsible for effects like analgesia, euphoria, respiratory depression, constipation, constricted pupils, physical dependence, and possibly vasodilation. I'm sure you can do a search if you want more info on
why exactly these receptors cause these effects.