This question already has an answer here:
I once read about a story in which, by a series of unlikely manoeuvres of time travel and a sex change operation, one person (originally a girl) managed to be her own mother and father. IIRC, she was brought up in an orphanage, travelled back in time to father a child (herself) with a near-stranger in a bar, then later became a man and travelled back in time to impregnate a near-stranger (him/herself) in a bar.
Unfortunately, because I only heard about the story and never actually read it, I have no idea whether it's a novel or short story, when and in what language it was written, what it looked like, etc. Hopefully the plotline will be distinctive enough to enable someone to find it!