Easiest way to create a USB HID device
The dead-simplest way is to buy an Arduino Leonardo.

I actually just did what you are talking about. In my case, I was converting an old arcade-style game controller to USB.

See the writeup I did here.


  Anyways, here are my modified files you would need to turn your own leonardo into a joystick. These files support an 8-axis joystick, with two hat-switches, and 32 buttons.
   If you want fewer buttons/axes/whatever, you can either just ignore the things you don’t need, or modify the HID descriptor yourself. As it is, for everything the HID descriptor currently specifies, it only needs 12 bytes per PC-update, so I’m not too worried about the extra axes causing issues or slowing things down.