As @geirandersen explained you can't treat the MacBook as an external display via the HDMI connection. HDMI is a Master-Slave architecture and can't be connected in the reverse.
With that said, we do have an ace up out sleeve!
You can leverage a peer connection over Ethernet between the two systems (Mac's are setup with signal discovery so you only need a straight Ethernet cable between, don't need a Tx-Rx flipped pairs cable).
So that solves the physical connection but we still need a means via software to transmit the signal to the Mac to allow screen sharing! If you had two mac's the service is part of macOS. Windows will require a suitable app and have the needed app for the Mac as well.
This setup does have its limits the PC's graphics is what the Mac will use so having a lower resolution PC you won't gain the better Retina resolution. The second as there is a bit of lag if you where thinking using it to playing online games as an example.
I use this to manage my headless Mac Mini from my other Mac systems and share music from it via iTunes.