Check if the entity is new from the entity insert hook
hook_entity_insert() is invoked only when an entity is created, not updated. That is evident from the method invoking it, EntityStorageBase::doPostSave().

  // Allow code to run after saving.
  $entity-&gt;postSave($this, $update);
  $this-&gt;invokeHook($update ? 'update' : 'insert', $entity);


hook_entity_update() is invoked for an entity being updated; otherwise hook_entity_insert() is invoked.

See also the description for the $update parameter passed to EntityStorageBase::doPostSave().


  bool $update: Specifies whether the entity is being updated or created.