Humans make illegal moves too. So much that there's a rule for it--
"Penalty for Illegal Moves The penalty for the first illegal move is to add two minutes to the opponent's time. A second illegal move results in loss of the game.".
https://new.uschess.org/sites/default/files/media/documents/...