Plug in a USB keyboard and it will let you login.
Keyboard might have failed, very common problem, especially when liquid is spilt on the MacBook.
Turn on the onscreen keyboard and then press each key, it will show the ones that actually light up when you press a key, if the wrong keys light up or multiple light up then you need a new keyboard. Cheap parts but needs someone who is good at repairing laptops and has patience to replace it.