This is quite normal. What happens is that you are lying still all night so gas may pool inside your intestines (rather than coming out a little at a time during the day) and then, when you get up and move around, you may have the urge to pass gas. This may be accentuated by the fact that your intestines have a natural rhythm which includes coordinated mobilization early in the morning, and this may also result in moving out more gas in the morning than at other times.
This is obviously not a medical problem and not something you need to worry
about. If you are concerned about the odor of your flatulence then, as you have already noticed, the most important thing is to avoid foods that provoke more gas and odor. Each person is different in this regard but it sounds like you already have a good idea of which foods do not set well with you.
As always, if you have any other questions about your intestinal or digestive functions, or your overall health in general, you should talk with your primary care doctor
. Your primary care doctor is well qualified to answer any basic question you may have.