take it into your head to do something
take it into (one's) head (to do something)
To decide or become set on the idea to do something, often something capricious. Jane has taken it into her head to become a glassblower, and she's already ordered all the tools.
take it into your head to do somethingdecide impetuously to do something.
1991 Ben Okri The Famished Road Fearing that the supervisor might notice me as well and take it into his head to order me to break my neck carrying cement bags, I hurried on.