How to modify and save a field in entry on EVENT_AFTER_SAVE in a plugin?
The accepted answer works but it's for elements in general, of which an entry is just one. Instead, you can skip checking if the element is an entry (if ($event-&gt;element instanceof Entry)) and just use the Entry class itself (it extends Element) like so:

use craft\elements\Entry;
use craft\events\ModelEvent;

Event::on(
    Entry::class,
    Entry::EVENT_AFTER_SAVE,
    function(ModelEvent $event) {
        $entry = $event-&gt;sender;
        $isNew = $event-&gt;isNew;

        if ($isNew) {
            // do your thing
        }
    }
);