What makes quitting smoking cause insomnia?

Stress. Changing habits - especially one that has a chemical content can be emotionally stressful. Nicotine is a real thing and lacking it is a challenge to your body. Ask a doctor for help getting through this time. You're doing a good thing. People will be happy to help. Good luck!