A good idea occurred to him.

Literal

Good idea [subject-が] him [to-に] came-to-mind.

Uses 彼に ('to him') as the indirect object of 浮かぶ. The verb 浮かぶ ('to come to mind, float up') can take either に to mark the experiencer of the thought, or a possessor-の structure linking the thought to its owner.