The first time was more like plagiarism really. I was in Miss Potts' English class (I remember her name because she was pals with the maths teacher, Mrs Chambers, and my sense of humour was really mature). So . . . I must have been thirteen, and I wrote a story about a gang of Hebridean Islanders who hung out in croft cottages and had ceilidhs and went herring fishing. Miss Potts gave me the feedback "Well done, Miss Beckwith".
(For those who don't know, Beckwith wrote a highly successful series of novels about a bunch of Hebridean Islanders, who hung out in croft cottages having ceilidhs when they weren't herring fishing.)
I'm sorry to say I pretended not to know anything about Miss Beckwith's oeuvre. And Miss Potts didn't push it. Since schools didn't have the budgets for raiding pupils' bedrooms and putting well-thumbed copies of Beckwith's books into evidence, no more was said. And if there's a better vaccination against plagiarism, I'm glad I didn't get given it. I squirmed for months and if I met Miss Potts today, the first words out of my mouth would be an apology.
The second time was deliberate. When I was just beginning to write seriously - so in the late 1990s - I wrote a story about Bertie Wooster.
Yup, PG Wodehouse fan fiction. I can't remember what it was called and I could only lay hands on it by dusting off a box of floppy disks (and finding a computer to put one of them in) but I do remember having a lot of fun. It was totally non-canonical: in it, Bertie is in his dotage sometime in the 1980s and he has a wife, children and grandchildren - in fact, Bertie and his wife are visiting a grandchild when the story opens. But Wodehouse was still writing about Bertie as a young bachelor-about-town in the 1950s. So it's truly, truly fanfic: Alt Bertie.
What a nerve, eh?