How to check parent & child category

On your category template you can use get_queried_object() to get the current WP_Term object. From that you can check the parent property, which is 0, if it is a parent, or some integer, if it is a child term as it returns the parent term’s ID.

$current_term = get_queried_object();
if ( $current_term->parent ) { 
    // child term
} else {
    // parent term
}