Malfunctioning of keyboard
Check your keyboard settings.

Go to  System Preferences... > Keyboard then the Input Sources tab.

Depending on your language, you should be able to see the current layout.

Keyboards can be configured for different languages and different layouts.  The US Keyboard standard is commonly called QWERTY as many physical keyboards are laid out that way.  Notice the keys from Q to Y left to right.  If you see your preferred layout there and it is not currently selected, change it.



UPDATE: Check that your keyboard may not have physical damage (liquid) by pugging in an external keyboard via USB or Bluetooth if you have one available.  If the external operates properly, there could be some physical damage.  If it operates the same as the built in keyboard, then the problem is in software.