If I understood right, right now you get all child terms of term with id = 5, but you need to show only terms from this list, which are attached to the post.
get_terms()
Retrieves the terms in a given taxonomy or list of taxonomies.
Try to use wp_get_post_terms()
instead, which allows you to set post id.
Make sure $post->ID is available.
wp_get_post_terms()
Retrieves the terms for a post.
$args = array( 'hide_empty' => '0','taxonomy' => 'book_cat', 'child_of' => 5);
$categories = wp_get_post_terms($post->ID, 'book_cat', $args);
//rest of your code goes here.....