Using random to generate strings
Your intuition was accurate! Here is a shortened version with (almost-)identical functionality:

from random import choice

def picks(filename):
    with open(filename) as f:
        lines = [line.strip() for line in f]
    return choice(lines).split()[0]    

def random_names(number_of_names):
    for _ in range(number_of_names):
        nselect = picks(choice(('femalenames.txt', 'malenames.txt')))
        print('{0:s}, {1:s}\n'.format(picks('surnames.txt'), nselect))

random_name(5)


Note the following:


str.strip removes whitespace (including newlines) by default, so you don't need to make the argument explicit;
random.choice is a neater way to select a random item from a list than generating and using an index;
random_names is a better name for the function, as you can specify a varying number of names;
You don't need to initialise nselect;
Why carefully adjust an index you aren't actually using by one? 0 is the default start for range, so we can just use number_of_names directly; and
Selecting directly from the two possible filenames makes the functionality more obvious (although you can no longer print(g), which was a bad name anyway).