how to get correct category of a post in case of multiple categories?

If a post has multiple categories there is no “correct” category. Any of them are correct, it’s a many-to-one relationship.

Since a post can belong to multiple categories it’s a mistake for any function to assume a single category. Expect an array.

If you’re looking to apply conditions based on one or more categories you could try if(has_category($category)) (if you’re not in the Loop you’ll need to pass the post object as the second parameter).

Edit from comment:

if(has_category('fitness')) { 
    // Example custom field 
    echo get_post_meta($post->ID, 'fibre', true);
} 
if has_category('children') {
    // Example custom field  
    echo get_post_meta($post->ID, 'protein', true);
}