How to show parent taxonomy using get_the_terms?

get_the_terms() gives you an array of WP_Term objects. The object has parent (int) property, which tells you, if the term is a child and has a parent term or not.

This means that in your loop you can skip child terms with a simple if statement.

foreach ($terms as $term) {

  // Is it a child term?
  if ( $term->parent ) {
    continue;
  }

  // code...

}