I tried adding this in entity_presave
$entity->setPublished(0); but the node still gets saved as published. How can I make it be set to draft?
I have tested with hook_entity_presave() and setPublished(0) and setPublished(FALSE) both worked. So the issue is somewhere else.
If you have workbench moderation installed, you may need to set it to one of your moderation states that set it to unpublished.
or perhaps a custom moderation state.
$entity->set('moderation_state', "draft"); worked