This is not an easy question, as you did not specify which platform you’re talking about. As far as computers go, everything is handled by DirectInput, which is part of DirectX. The hardware gets plugged in, is recognized by the driver, and sends data to the computer which is read by the driver and sent over to DirectInput, which allows the game to read input in a standardized way. From there, the engine, will read this input and act upon it as defined by the program.
You can’t just plug in a joystick and have it work in maya, no. Maya would need to support joysticks first, which I do not believe it does.