The reason for this is that the auto system tries to line up the guns to the place where you point. As main guns can't rotate 360°, there is always a spot where your guns will never reach.
When you press that spot, the gun that can't get aligned tries to rotate the other way in order to reach the spot, but of course... it won't reach it. Thus leaving the gun dissaligned in the other side of the ship.
I know you don't want to hear this, but the only way to avoid it is using manual because with it you are the one who controls the guns and they won't go nuts trying to reach a spot you know they can't reach.