In short, after anesthesia
is induced, the chest is opened and in some cases, the heart
and lungs are bypassed (some are not done this way).
Then arteries or veins are used/harvested to bypass heart blockages and then the chest is then closed and anesthesia is reversed. It is a bit more complicated, but this is the best brief answer i can give.