Why does MacBook not respond to keyboard?
Actually, I can't explain this to you because what you describe is not typical behaviour. 

I know it's not what your actually asking, but we could try and resolve the issue instead.

You don't actually specify the version of macOS or the exact model of MacBook, but you could try resetting the NVRAM and SMC (in that order) to see if that will resolve this issue. 

Before following the steps below, ensure you have no external hardware connected and that you're using the built-in keyboard.

Reset the NVRAM

Reset the NVRAM on your MacBook as follows:


Shut down your machine. Yes, a full shut down, not just logging out.
Press the power button and then press the commandoptionpr keys. You have to make sure you press these keys before the gray screen appears or it won’t work.
Hold those keys down until your MacBook reboots again (i.e. you hear the startup chime a second time).
Let go of the keys and let your MacBook reboot normally.


Note: When you log back in you may need to readjust some of your system preferences (e.g. speaker volume, screen resolution, startup disk selection, time zone information, etc).

Reset the SMC

These steps assume you have a Macbook with a non-removable battery. If you have one with a removable battery, then let me know and I'll change these instructions!

To reset the SMC on your MacBook, follow these steps:


Shut down your MacBook
Keep the power cable plugged in.
Press at the same time shiftoptioncontrol (on the left side of the keyboard) and the power button
Let go
Turn your computer back on with the power button.


After resetting both the NVRAM and SMC check to see what happens now with your keyboard after sleep. If the problem persists, then let me know and we'll try a couple of other things as well.