This is a frequently-asked question, the difference between agoraphobia and claustrophobia. Agoraphobia is the fear of being in places where you might have a panic attack or escape might be difficult. Some people with panic disorder go on to also develop agoraphobia. As agoraphobia progresses, you increasingly become home-bound, as you are fearful of places where you might have a panic attack, or where escape is difficult.
On the other hand, claustrophobia is the extreme fear of closed, confined spaces, from which escape is difficult. If you have claustrophobia, you will become highly anxious or have a panic attack if you are in a closed, confined space.
So the main difference between the two is that in agoraphobia, you have a fear of places as you may have a panic attack there (or escape may be difficult), whereas claustrophobia is the extreme fear of confined, closed spaces.