I am using a "GameStop" branded Xbox 360 controller (it's made by MadCatz). I am indeed using Ubuntu 16.04. I thought that there was an issue with the controller driver, so (though it did work in both programs individually) I installed xboxdrvr. This completely borked my controller and I had to uninstall it because Ubuntu's was actually working fine. I installed a key mapper (can't remember the name) and that did not fix the issue either. At the end of the day, I do not believe it is a controller issue. The best way that I can describe it is that there is no handoff from Attract Mode to MAME.
When I launch MAME, both it and attract mode are running on the surface, but Mame is on top. For example, pressing the "x" button on the game pad executes the function that it serves in both programs. In this case, it is mapped to "execute" a game in Mame (From attract mode) and it is also mapped to Player 1 Button 1 in Mame itself. When I press it, Mame receives the command to press button one, and Attract Mode receives the command to launch the game (again). When this happens, Mame relaunches itself in a new window (and will continue doing so as long as I keep hitting the button). The same behavior happens for all of the other buttons I hit as well (down moves wheel Dow in attract mode AND serves as P1 down in Mame). It's really frustrating, so I had to step away for a few days to save my sanity.