A story written by someone who enjoys a particular fandom in that fandoms universe, usually involving characters and places in that universe.
when fanfiction is good
sometimes fanfiction can be good, interesting stories or lore fixes can be made and usually its suprisingly well written.
BAD fanfictions usually are stories that are the writers Sexual fantasies written down on paper (E.G. a certain story involving gay orks or making your waifu fantasies with Elesh Norn come true. and thats barely the tip of the iceberg.) we call those FapFictions