The major cause of gas pains is diet typically caused by the breakdown of food in the gastro-intestinal tract. If you have issues you should check what you are eating.
It could be irritable bowel or otherwise know as IBS. It can cause pain when you have gas or when you are having a bowel movement. It can be VERY painful.
There are mainly two causes for being gas pains.
1. Air which has been swallowed by the individual.
2. Breakdown of certain undigested food particles by certain bacteria preset in the normal flora of the colon.