Blood flow to the heart is self-regulating (autoregulation) by two processes - Metabolic autoregulation and Myogenic autoregulation.

Metabolic antoregulation
Cellular waste products accumulate in active heart tissue.
When their concentration reaches a certain level the metabolites cause coronary vessels to dilate and blood flow is increased.
This washes away the metabolites restoring homeostasis.

Myogenic autoregulation
This depends on the properties of coronary smooth muscle. As blood pressure rises the vessel walls are distended which causes the smooth muscle cells in the wall to contract and the vessels to constrict, reducing blood flow.