This seems a bit fishy indeed.
Have you tried to install or run any programs out of the ordinary recently?
If Avast is updated regularly, I would think it would be pretty hard to have a virus do something like this without avast notifying you. Also, a good virus would format the drive without letting you know.
I'm thinking some keys on the keyboard were "stuck." Either being pressed by accident or Windows is "seeing" keys being pressed and held down. For example, I’ve seen plenty of times where a Bluetooth keyboard will randomly "freeze" and keep repeating the same key on the screen.