A ghostwriter is an author who is paid to write a book under another author's name. The practice of ghostwriting is often applied in autobiographies. The person who's interesting enough to have an autobiography published often does not have the literary skill to make their life into a story that is pleasant to read. It also happens in long-running series, such as Animorphs, when the original author may not have the time or energy to keep up with the series' publication schedule.
Ghostwriting is not the same as plagiarism, which is copying someone else's story without giving them credit, or using a penname, which is writing your own story under an assumed name. A ghostwriter writes someone else's story under that person's name.
Ghostwriters are (generally) not actual ghosts; they are called that because—like most ghosts—they stay invisible.
If there are any ghostwritten fanfics out there, we don't know about it.