The causes of anxiety attacks relate to the adaptive and protective functions of anxiety. Let's look at why people become anxious and what to do about it.
If, for a moment, we consider anxiety to be like fear (see this page more information on how fear and anxiety differ) anxiety is like an "alerting signal" for the body. "As an alerting signal, anxiety can be considered basically the same emotion as fear. Anxiety warns of an external or internal threat; it has lifesaving qualities." (Kaplan and Sadock, pg. 189).
Okay, so fear that warns of possible danger (like bodily harm, social consequences, punishment, or any other sort of threat) can be helpful because it keeps us from doing things that will have undesirable consequences or harm us in some way. That's a good thing. Without any fear, we may unknowingly act in ways that have undesirable consequences.
The need to avoid danger or embarrassment is a key cause of anxiety.