Hallucinating is literally how human and artificial neural networks function!
When we dream, our brain links disparate, unconnected memories to flush them out of our sub-conscience.
A dream - or a nightmare - feels real because our brain is trying to protect us from our memories.
When an AI hallucination is factually correct, it's a coincidence.