pop into (someone's) head
To occur or form suddenly in someone's mind, as a thought, idea, or revelation. The idea for this new model of car just popped into my head as I was driving home last night. I had been struggling to remember her name throughout the evening, but it only popped into my head the next morning.