It could be a lot of things. You need to focus on getting it to work with the cable first - Restart the iPhone, and if that doesn't work, restart the iMac. If it still doesn't work, try another USB port on the iMac, then a different cable.
If the wifi syncing doesn't work after all that, and has in the past, restart your router.