It is not a fast heart rate but the underlying mechanisms that can affect health. The mechanisms involved in exercise can be beneficial and those in anxiety harmful.
Physiological responses and long-term adaptations to exercise (CDC.gov):
...the cardiovascular response to exercise is directly proportional to
the skeletal muscle oxygen demands for any given rate of work...
Table 3.2 from the same source shows cardiovascular changes after 6 months of endurance training, for example, increased heart volume, increased stroke volume at rest, lower systolic blood pressure at rest and increased blood volume.
Long-term exercise and the associated increased oxygen demand also results in more dense capillary network in the heart and skeletal muscles, and therefore their better oxygen and nutrients supply.
Regular exercise can have other benefits, such as easier maintenance of healthy body weight, increased muscle mass, lung volume and insulin sensitivity, and lower LDL cholesterol (CDC.gov) and mortality (PubMed).
In anxiety, there is no increase in skeletal muscle oxygen demand, so there should be no cardiovascular benefits (concluding from the quoted part from the CDC.gov above). In contrary, mechanisms involved in long-term anxiety my be harmful for the heart:
Anxiety and cardiovascular risk...(PubMed):
...anxiety appears to predict more cardiovascular symptoms...and
Anxiety disorders and cardiovascular disease (PubMed):
The relationships between anxiety disorders and
cardiac outcomes likely are mediated by both behavioral and
physiologic mechanisms, including autonomic dysfunction, inflammation,
and platelet aggregation.