How to remove the whitespace in image name and save the new file

Use sanitize_file_name( $filename ). This function doesn’t just catch white space, it removes other special characters too:

$special_chars = array(
    "?", "[", "]", "https://wordpress.stackexchange.com/", "\\", "=", "<", ">", ":", ";", ",", 
    "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", 
    "!", "{", "}", chr(0)
);

Find the following line in the plugin’s code:

$id = media_handle_sideload($file_array, $post_id, $desc);

Immediately above this line add:

$file_array['tmp_name'] = sanitize_file_name( $file_array['tmp_name'] );

Caveat: I haven’t tested it.

Make sure to rename the plugin and the plugin’s file name. Otherwise you get upgrade notices. And contact the author, ask him to implement these changes.