I have seen this behavior in laptops where their keyboard and touchpad are identified as PS/2 devices in Device Manager. Most likely there will be a yellow ! on the keyboard device indicating a problem. I would use an external USB mouse, just in case, then load Device Manager and uninstall (delete) any other mouse or keyboard. Restart and the laptop's one should now work fine. Should you need to type while doing this, you can enable the onscreen keyboard. I don't remember if this applies in Windows 11, but in 10 you do that by right-click on the taskbar and select Show touch keyboard button. Then click on the button to show or hide the keyboard.