Gas is typically caused by either swallowing air while eating or drinking, or it forms in the intestine when your food is being digested. Your intestine contains bacteria that help digest and break down the nutrients from your food, which also produces gas.
Some foods can cause more gas than others, just as you pointed out. Certain types of dietary fiber, like soluble fiber in fruits, vegetables and legumes, is digested more easily by bacteria and can cause gas. Another thing to consider when choosing food is if it contains sugar alcohols; they are often found in foods that are considered diet, calorie- or sugar-free. When looking at the ingredient label, keep an eye out for ingredients that end in "-ol,” including xylitol, sorbitol, or Maltitol. These often cause indigestion, gas, and bloating because your body cannot fully digest them.
If you don’t typically include sugar alcohols in your diet, your chronic gas may indicate a food intolerance — most commonly lactose found in dairy products — or a bacterial imbalance in your gut. However, I definitely encourage you to work with your healthcare provider to find the best solution, especially if you’ve been experiencing nausea or vomiting, diarrhea, constipation, chest pain, or weight loss.
In the meantime, you might find success incorporating foods into your diet that are known for positive digestive effects. Some examples include ginger, Greek yogurt, lemon, and naturally fermented foods like kimchi or kombucha. You may also want to try incorporating a daily probiotic into your routine. Fortify® 30 Billion Daily Probiotic or Probiotic Pearls® Acidophilus are two great options to begin with, as both support digestive and immune health while also protecting against occasional bloating, constipation, and digestive discomfort.*