Add role to user account when register or create

// use hook_entitytype_presave
function modulename_user_presave(Drupal\Core\Entity\EntityInterface $entity) {
    $entity->addRole('rolename');
 }

This will add your role when user registers or created

Drupal 8

Or You could simply use Registration role module working version : https://github.com/karthikeyan-manivasagam/Registration-role-drupal-8/