Could be down to virus/spyware etc, but not likely.
Or could by lack of system resources.
More likely, is that something maybe running in the background, usually this is anti-virus or spyware scanner. As these are set for scheduled scanning, this would explain why you only notice this occasionally.
I really doubt that it is your keyboard, however, if you run out of other poss explanations, they are relatively cheap to replace.
Hope this helps, puts you back on page 1 anyway, so someone else may have other ideas.