If a person is hyperventilating it is usually due to the bodies response to high CO2 concentration basically means fast and rapid breathing. Some of the causes are anxiety, fear, or stress but also drugs overdose or lung disease. The normally breathing is when we breathing in we inhale O2 and when we breathe out CO2. I think that for some people breathing into a paper bag makes them feel and have less anxiety. Other people think that it can be dangers because you are breathing more CO2.
Some ways to prevent hyperventilation you can use medication for anxiety, learning how to calm yourself down before you lose control of your deep breathing, and finding a way to reduce your stress levels. I remember an episode that I was in airplane going to Florida I did have anxiety attack I was hyperventilating my husband give me a paper bag and I start breathing in and out but for me did not do nothing for me because I also start feeling lightheaded, so I stop and I concentrated on taking deep breaths in and out for few minutes that help me with this issues. Now I do my exercise any time I feel like that. For me on my opinion did not work and I do not recommend to other people just deep breathing excises.