I'm not a doctor, so please be sure a doctor does check your heart and look into these things.
I've had problems off and on with generalized anxiety disorder, and all the symptoms you describe are familiar. GAD is pretty common. With anxiety, sometimes the physical symptom of racing heart actually comes before you experience the emotion of anxiety.
If it is just anxiety, that's good news, because that is treatable. Stopping exercise and getting deconditioned doesn't help. Try to at least take walks regularly. Not running for 3 weeks and then running would make you tired, it's just a loss of conditioning.
Beware of Xanax, which can stop anxiety for a while, but then you feel terrible coming off it and have nightmares. Increasing the dose can lead to addition. Lexapro worked well for me; but with some discipline I found that _cognative behavior therapy_ was better and drug-free -- basically just learning to control your thoughts and behavior is often enough to manage anxiety -- don't catastrophize and dwell on worst-case scenarios, don't push friends and family away, etc, etc.
Good luck Andrew.
You should have either a Holter monitor or an event monitor to record your EKG during on of these episodes to see if the palpitations are a serious problem or not.