Hi there, this exact thing happens to me, within minutes of becoming anxious, it seems. It's a biological reaction to stress hormones that is normal. I think remar is right, if you get your anxiety under control, this will probably help with the intestinal problems. IOn the meantime, I would stay away from coffee andmaybe sure you're drinking plenty of water. I hope you feel better soon.
You say this happens when you're anxious, so it has be do something with your anxiety. Are you seeing a therapist? Are you taking any meds for the anxiety? Maybe if you can get the anxiety under control with intestinal problems will stop. The problems you're having are not that uncommon with anxiety.