When was the first fictional story written? By fictional I mean not only that the events in it did not happen but also that it was identified as fictional by the author and by its readers, meaning it was distributed as fiction. So I am not including fables and myths, since they were presumably believed by their early audiences.
I am not very well read but the oldest definite example I can think of is Shakespeare. Many of the ancient texts I can remember are set in the 'time of the ancestors' and were delivered as history not fiction. I am just mainly interested in approximately when the transition from relating stories as histories to relating them as fiction happened.
hi! not dissuading anyone from answering here, but FYI, this question might do better in /r/AskLiteraryStudies. Meanwhile, to kick things off, this sub often get questions about early Science Fiction, so you can check out responses on the earliest example of that genre (TL;DR: Lucian's True History) in the FAQ:
What was science fiction like in the past? How did ancient people imagine the future?
Shakespeare did his writing around 1600. You can look up the exact dates, but it's useful to fix the year 1600 in your mind next to the name Shakespeare. Shakespeare was a playwright and a poet; we remember him most popularly for his plays.
Aristophanes was also a playwright. He wrote a very famous play called The Frogs in 400 BC, near enough makes no difference exactly two thousand years before Shakespeare wrote his plays.
But Aristophanes was late to the party, all things considered. We've identified tons of literary texts that date back to the Bronze Age, the Egyptians and Sumerians, between five and six thousand years ago.
And maybe that's not going back far enough either. We've found 40,000-year-old cave paintings that may depict a kind of pre-literate narrative of some variety. They feature lots of animals but very few people and nobody knows why. If our ancestors were using those paintings to tell each other stories, we don't know what stories they were telling.
Anyway, bottom line is that nobody has the foggiest idea what the oldest story is. We know it predates recorded history, and the safe bet is that it predates it by a lot. And if you asked me to bet, I'd say it was almost certainly about a boy who tried to impress a girl.