Ok, thats promising.
That means that they are both being picked up from the auto config folder.
This command will show those files, it will also show if you set them up, or they are stock versions. (Assuming you are on 2.4, other wise use RetroArch instead of retroarch)
ls -lah /opt/retropie/emulators/retroarch/configs/
(Check the timestamps on the files)
Perhaps there is a stock file in there, that is detecting your controller but has the wring button mappings set.
Also, make sure you havent specified anything in your main retroarch.cfg for controllers.