Yes, anxiety and stress can give you diarrhea. When you are stressed and anxious, you activate the fight or flight response. This activates both the sympathetic nervous system and the HPA axis (hypothalamic-pituitary-adrenal axis). This results in a cascade of physiological effects which are summarized in the following illustration:
So what happens with the fight or flight response is that it shunts blood away from the digestive system, and it affects the motility of your gastrointestinal system. So when you are stressed, anxious, and nervous, you may get gastrointestinal symptoms, such as diarrhea, vomiting, stomach cramps, and/or the feelings of have butterflies in the stomach.
If you have gastrointestinal problems with stress and anxiety, then the solution is getting help to eradicate anxiety and stress.