So, you can get the category name with get_queried_object()->name
:
if ( is_category() ) {
echo do_shortcode( '[x_recent_posts type="post" count="2" offset="" category="' . get_queried_object()->name . '" orientation="vertical" no_sticky="true" no_image="false" fade="false"]' );
}