How to create a CSV on the fly and send as an attachment using wp_mail?

That’s because wp_mail expects the attachment to be a filename (filepath) that it can attach and send. You are supplying a string containing the contents of the file:

function create_csv() {

    $filepath="/path/to/the/file.csv";

    $fd = fopen($filepath, 'w');
    if($fd === FALSE) {
        die('Failed to open temporary file');
    }

    $records = array( array('dummy', 'data', 'found', 'here') );

    fputcsv($fd, $headers);
    foreach($records as $record) {
        fputcsv($fd, $record);
    }

    rewind($fd);
    fclose($fd);
    return $filepath;
}

will solve your problem. See http://codex.wordpress.org/Function_Reference/wp_mail