You can attempt to do a system recovery (it will reset the computer to factory specs) from the boot menu. Here is a link to a website that will give you step by step instructions. I hope this helps. http://www.ehow.com/how_6904280_do-system-restore-emachines.html
You can try shutting down the computer and restart. If the keyboard came unplugged by some chance the computer will not recognize it until it has been shut down and rebooted, unless of course it is a usb keyboard. USB devices are hot swappable and do not require the computer to be off before plugging in. If that does not work you may have a bad keyboard. Luckily, they do not cost much to replace. A second hand store is a good place to pick up a spare for just such occasions.
If you believe AVG is the cause of the problem you can boot into safe mode. From safe mode you should be able to disable or uninstall AVG. To get to safe mode most computer require you to tap the F5 or F8 key. Your problem also sounds like you computer could be infected with a virus or malware. You may want to boot into safe mode and run a virus and malware scan to see if that corrects the problem.