SEO Friendly URL on dynamic product page produced via shortcode

Your rule needs a little tweak. You also need to add id to valid query vars.

function wpd_test_rule() {
    add_rewrite_tag( '%id%', '([0-9]+)' );
    add_rewrite_rule(
        '^product/([0-9]+)/([^/]+)/?$',
        'index.php?page_id=5&id=$matches[1]',
        'top'
    );
}
add_action( 'init', 'wpd_test_rule' );

Note that WordPress doesn’t put query vars in $_GET, you’ll need to adjust your code to use get_query_var('id') to fetch the value. I’d also consider using something more unique than id.