Your issue seems linked to the 'timeout' option, and its friends 'timeoutlen', 'ttimeout', 'ttimeoutlen'.
Try this command:
:set timeout timeoutlen=3000 ttimeoutlen=100
It's taken from :h 'ttm:
The timeout only happens when the 'timeout' and 'ttimeout' options
tell so. A useful setting would be :set timeout timeoutlen=3000
ttimeoutlen=100 (time out on mapping after three seconds, time out
on key codes after a tenth of a second).
Personally, I use these settings:
set timeout
set ttimeout
set timeoutlen=3000
set ttimeoutlen=50
The first 2 commands enable a timeout on mappings and keycodes respectively.
The 3rd command set timeoutlen=3000 tells Vim to wait 3s to let me finish typing the left-hand-side of a mapping.
The 4th command set ttimeoutlen=50 tells Vim to only wait 50ms for a sequence of keycodes to finish. For example, on my machine, F1 produces the sequence of keycodes Escape O P (confirmed by typing C-v F1 in insert mode, which displays ^[OP; ^[ stands for Escape).
It's possible that your original issue comes from the fact that the value of your 'ttimeoutlen' option is too high, and therefore the timeout for a sequence of keycodes doesn't occur soon enough, allowing Vim to sometimes interpret a sequence of keystrokes you type as produced by some other key you didn't press. By reducing its value, you may prevent this.
If your issue persists even though you set the previous options in your vimrc, it's possible that a plugin changes them afterwards.
In this case, when your issue occurs again, type these commands:
:verb set timeout?
:verb set ttimeout?
:verb set timeoutlen?
:verb set ttimeoutlen?
Each of them will tell you the current value of your options, but more importantly it will tell you the name of the last file which changed the value.