His research was on compounds related to ergotamine. It was not some random adventure, the fungus that produces it has a long history of use by midwives as folk medecine and is still used today to treat postpartum hemorrhage. Now, what piqued his curiosity? Did he have knowledge about the "dancing plagues" and the theories they were caused by ergot contaminated grain and if he did, did he make the connection to his feeling of restlessness?
Edit: He also spilled some on himself, it was not the mouse or whatever that was restless. It was him.