Replace Underscore (_) on Space ( )

You are correct, you need to use str_replace. See details here

So the correct code would be:

$postData = array(
'post_title' => str_replace('_', ' ', $attachment->post_title),
'post_type' => 'post',
'post_content' => $image_tag,
'post_category' => array('0'),
'post_status' => 'publish'
);