You can change the gamepad buttons from the RetroArch menu for a specific emulator or game: https://retropie.org.uk/docs/RetroArch-Configuration/#core-input-remapping