Wiktionary
n. (context narratology English) A literary device in which the author writes himself or herself into the story as a character.
Wikipedia
Self-insertion is a literary device in which a fictional character who is the real author of a work of fiction appears as an idealized character within that fiction, either overtly or in disguise.
The device should not be confused with a first-person narrator, or an author surrogate, or a character somewhat based on the author, whether intentionally or not. Many characters have been described as unintentional self-insertions, implying that their author is unconsciously using them as an author surrogate.
In art, the equivalent is the "inserted self-portrait", where the artist paints a self-portrait in a narrative subject, which has been common since at least the Renaissance.