Use get_cat_ID to retreive multiple category IDs

$category_in = array();
foreach($topicsofinterest as $topicofinterest){

    //Chaneg 'category' to the taxonomy name.
    $term = get_term_by( 'name', $topicofinterest, 'category');
    
    $category_in[] = $term->term_id;
}

Just curious, why don’t you store the category ID instead of category name in user meta?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)