Here is how I got the Xbox 360 controller working, I hope this helps:
1. Install the game
2. Make sure the Xbox 360 controller is plugged in and working
3. Open the 'DOSBOX' subfolder in the 'Rayman Forever' folder ("C:\GOG Games\Rayman Forever\DOSBOX")
4. Click on 'DOSBox.exe'
5. Hold Ctrl and press F1
6. Map the Xbox 360 buttons to the DOSBox Keyboard's Keys: Left-click on a key on the on-screen keyboard, then click 'Add', then press a button on the Xbox 360 controller to map that button to the keyboard key.
Note: It's really only the D-Pad, Trigger buttons and the Y button that you need to map, the rest will work by default. This is because Rayman actually already automatically recognises the Xbox 360 controller as a proper gamepad without you having to do anything, it's just that it doesn't recognise the D-Pad or Trigger buttons. It's best not to map the buttons that the game does recognise since not only is it unnecessary anyway, but if you ever change the controls for those buttons in-game then they'll be different from the DOSBox map of them and then there'll be two conflicting actions assigned to the same button. So only map the following buttons to the corresponding keys:
Keyboard Key - Controller Button:
Up Arrow - D-Pad Up, Left Stick Up
Down Arrow - D-Pad Down, Left Stick Down, Left Trigger, Right Trigger
Left Arrow - D-Pad Left, Left Stick Left
Right Arrow - D-Pad Right, Left Stick Right
Esc - Y
(I find that setting the Triggers to the down key is really useful for crawling with Rayman, since you can change directions easily then with the D-Pad)
Note: For this game, the following controller buttons are linked to other controller buttons, so that you can't have one of them perform one action and the other perform a different action, they must both perform the same action.
A + Left Shoulder
X + Back
B + Right Shoulder
Y + Start
So if you want the A button to make Rayman jump then the Left Shoulder button must also make him jump, you can't assign that button to do something else. So that's why I don't have either of the Shoulder Buttons in the list above. This is also why I also have the Y button mapped to the Esc key, because that automatically maps the Start button to it as well (in fact just mapping the Start button to the Esc key won't work, you have to map the Y button to it).
7. Click Save
8. Click Exit
9. Close DOSBox
10. Go back to the main 'Rayman Forever' folder
11. In a separate folder, go to the location "C:\Users\(User)\AppData\Local\DOSBox"
12. Move the newly created 'mapperfile=mapper-0.74-2.1.map' file in that location to the 'Rayman Forever' folder
13. You can then delete the other 'dosbox-0.74-2.1.conf' file in that location and you can delete the 'DOSBox' folder altogether from the 'Local' folder
14. In the 'Rayman Forever' folder, rename the .map file that you just moved there to something more suitable like 'RaymanXbox360Controller.map' or something (just make sure that you don't use any spaces in it though)
15. Open the file 'dosboxRayman.conf' in a text editor like Notepad
16. There is a name in the text called 'mapperfile', the value of it should be the same as the name of the .map file you just moved into the 'Rayman Forever' folder and renamed, so rename its value to that
17. There is another name in the text called 'joysticktype' that has a value called 'auto'. Change this value to 'fcs'
18. Save these changes you've made to the 'dosboxRayman.conf' file
Note: Since you haven't mapped the A/B/X buttons, you'll still need to reassign them to your liking in the Options Menu in the actual game itself (this takes literally just a few seconds though)