Ok. So I got a new hp laptop about two months ago and it's been working fine except for one thing. So I started seeing this issue in games. If I've been playing for a while in the keyboard, when I'm fiddling with my keys ( I was using wasd) and I pressed the D key for a while and was pressing the w key after, my character would move to the left automatically (w does work i.e it moves the character in a weird 45 degree angle towards the left rather than a 90.) This has been happening for a while now. The funny thing is that the keys are not at all jammed and can be resolved by repeatedly pressing the key which has been automaticallly working. In a way, this is a huge frustration since say, I am hiding under a tree in a game. And I just pressed A to move my character to the right to fully hide. Suddenly, my character would keep going to the left and I would get exposed. Note that this issue happens all of the wasd keys. I don't know if it's there for any other key........
Check if this happens on Word. If it does, check if it happens on Word in Windows Safe Mode to see if it is a driver issue. If it only happens in the game, it is likely the game settings where the keyboard mapping is wrong.
Check if it happens with an external keyboard. If it doesn't, you probably have a faulty keyboard.
You can download a diagnostic from HP to test your keyboard. However, your laptop is still under warranty so you should send it back for repair (do a backup before you do). I suggest you get an external gamer keypad as you will wear out the built in keyboard by gaming.