Display a category name automatically using code in the functions.php file

Would each post only be in one category?

You’d first need to get all the categories associated with the post, and then output only first. Here is an untested example:

function add_before_content($content) {
    $post_cats = get_the_category();
    return '<p>This post is in the ' . $post_cats[0]->cat_name . ' category</p>' . $content;
}         
add_filter('the_content', add_before_content);

Reference: http://codex.wordpress.org/Function_Reference/get_the_category