Why do you write? What drives you to put words to paper or screen?
I write because I have something to say, and I want to world to learn about my vision of the world. There is much to make commentary on in society and the world at large, and I use my writing to do just that. I have a purpose in writing. I believe that that is the difference between "literary" fiction and non-.
Too many people get hung up on writing what they deem to be literary fiction, when inevitably someone else makes that decision for them. I intend each time I write to produce something that will one day be literary, because I write fiction that has a definitive purpose. To me, that purpose makes my fiction literary as opposed to commercial (using the definition of literary not to mean "good, scholarly, 'important' fiction").
This was a topic of discussion between me and another writer colleague of mine. To both of us, there was a significant difference between writing that sought only to entertain - that is, to provide titillating fiction with no drive for the reader to have to work at it - and writing that is meant to enlighten. The difference between the two is something of a personal definition in my opinion, and I think it's pretentious to try and impose your own definition on someone else's fiction. However, to understand the literary community and the editors who (unfortunate though it is sometimes) hold reign over it.
The term 'literary' has been used too often to be the definition of "good" fiction. Fiction that doesn't adhere to the formula of the classics tends to be looked down upon as "commercial" or "mainstream" well before it gets the appropriate reading that it deserves. Editors love to think that they're in the powerful position of helping to continually redefine what is literary, when it can only be proven that future generations will be the one to determine what sticks around and what does not. Despite the academic community's refusal to recognize genre fiction as "literary," books like The Lord of the Rings, War of the Worlds, and Brave New World continue to be wildly popular and in the case of LOTR the second most purchased book in the 20th Century. How, then, does this make them less literary when all of them teach us a variety of things and enlighten us to the widely different ways of human nature?
In the end, find your own purpose. This is just my definition. But you should have one, because to write is to put your very passion out to the world and if you're doing it "just cuz" then you're opening yourself up to a world of painful rejection, which is never a good thing.