Hi there, the Astro Pi joystick is mapped to the four keyboard cursor keys, with the middle-click being mapped to the Return key. This means that moving the joystick has exactly the same effect as pressing those keys on the keyboard.
So does the pygame joystick example work if you use the cursor keys on the main keyboard?
The only thing I can suggest is to wipe the SD card and do a complete reinstall from scratch. Don't ever
do a sudo apt-get upgrade
as this downgrades the kernel. Something we will fix in due course but for now just reinstall Raspbian and run the install script again as per this topic
If it still doesn't work after that then yes you may have a broken joystick, have a close look and see if there are any cracks on it.
One thing you can be sure of though, if you write code the responds to the cursor keys and Return you'll know that it will work on Tim's Astro Pi on the ISS (if that's any conciliation). You may also be able to return the board to the UK Space Agency and get a replacement.