Updated iMac to Yosemite 10.10.5 and USB keyboard stopped working
Try this, while it is very basic: https://support.apple.com/kb/PH19094?locale=en_US
Also check what other USB are working (mouse, etc.)
Do a PRAM Reset
Restart >
Command + Option + P + R
holding the keys when the Apple sign doesnt appear yet on the screen,
it restarts and USB ports start working.

You can also try a SMC: https://support.apple.com/en-us/HT201295

I am using a new iMac with El capitan and preferred using my old USB keyboard instead of the elegant wirelerss one. No problems.