Basically a marketing term, for people who sell books, and for people (like agents) who sell the works of writers to people who publish books.
James Joyce, for example, wouldn't have said he writes literary fiction. Nor would someone like Philip Roth say that today.
The term is used to delineate "serious" fiction from other forms of fiction, like, science fiction, romances, mysteries, thrillers, etc.
The term is not meant to be disparaging. After all, science fiction, spy novels, etc are pretty serious, while some literary fiction can be quite humorous and seemingly not very serious (think "Even Cowgirls Get the Blues," "Catcher in the Rye" or "Portnoy's Complaint").
And many people who make their living with literary fiction (either by writing it, critiquing it for newspapers and magazines, or evaluating it in university courses) are often big fans of the less "serious" forms of fiction, and may even be writers of the genres themselves.