So, for example, the Arma A-10 has its gun pointing downward, about 10 degrees IIRC. So when your gunsight is aiming at, say, a tank, and you're flying directly toward it, then your bullets will land over and behind it when you fire. So you need to aim under the tank (at the ground between you and the tank, close to the tank). Again, real A-10 pilots don't have this problem because the gunsight is aligned. (Also, they have a computer-assisted gunsight, I believe, but they don't have this problem even if they turn it off.)
Another problem with the gunsight not being aligned properly is the one you're having--rolling the aircraft moves the gunsight around, because the gunsight isn't close to the roll axis. This makes shooting extremely difficult, even for a highly-accomplished virtual pilot. The solution is mostly to zoom in, use rudder, and walk your tracers on target. Do a minimum of rolling; as long as your nose is "mostly" pointed at the target, you can use rudder to do the rest. Practice, as with any virtual (or real) flying activity, is the most important part. Oh! I nearly forgot--the SU-25, alone of all the fixed-wing aircraft in the game, has a cannon which is correctly aligned. Unfortunately, there is very little ammunition in it, so learning gunnery on it can be tricky, but it'll be much, much easier to aim with it.