create filter in functions.php

Whenever you see apply_filters( 'filter_name', $value ), you can use add_filter() to replace or modify the value of $value:

add_filter( 'filter_name', 'callback_function' );

Where callback_function is a function that you create. That function will accept $value as an argument, and needs to return a new value. So for your example, that will look like this:

function wpse_275788_replace_icon( $icon_html, $id ) {
    $icon_html="Put new icon html here.";

    return $icon_html;
}
add_filter( 'woocommerce_gateway_icon', 'wpse_275788_replace_icon', 10, 2 );