Well..lét me start off by pointing out I am not a doctor so I can't know anything about why you feel bad except that you think it's anxiety (consult a real doctor)....
I will say though that I had the same problem when I was younger. People would say I wanted attention and I totally did not, anxiety did make my stomach feel really miserable, and just like you said, just having a stomachache made me more anxious and it was a cycle that was hard to break.
I saw my physician who helped a lot with meds and someone to talk to, also parents helped.
One thing I figured out how to do by myself was to calm down right when my stomach got upset by telling myself "think simple thoughts, this will be over soon." It keeps me from thinking about stress inducing things that made the discomfort worse. I learned to read my body's signals and now I can tell when it's almost over, and each time I had an "episode" and got through it, it made things easier.
Wen I was younger I didn't think it would ever get better but it did so hang in there. 