The easiest explanation is that there is no "knowledge" involved, just physiology/molecular biology. In an area of low O2 and high CO2 (therefore a demand exists for O2), the oxygen dissociation curve will favor O2 release into the blood, which will then oxygenate the tissue.
Similarly, concentration of CO2 affects localizes extravascular pH. If there is a high amount of CO2 - which occurs with muscle use, among other things - the change in pH caused dilation of arterioles, allowing more blood to flow to those tissues that need it, releasing oxygen via the O2 dissociation behavior.
This is a simplified but essentially correct of the control of oxygen release to tissues that need it.
But the greatest subsequent vasodilation [in skeletal muscle] is due to local chemical factors. These are changes that occur during exercise in the extracellular fluid surrounding skeletal muscle cells. Such changes occur naturally as the cells consume more energy; in other words, the effect occurs automatically as a muscle exercises and only in the specific muscles working. The brain does not need to get involved in trying to adjust blood flow to the correct muscles. It happens automatically through this local mechanism.
More information can be obtained by reading the article linked to below.
Control of Arterioles