For me it was pretty simple - I wanted to build things that people would use. Learning to code was the easiest way to achieve that goal. Additionally, my university taught us programming from Day 0 (you know C, C++ etc). However, there was no practical way to validate what I was learning. So, I ventured out on my own and started learning PHP (it wasn't a part of university curriculum). I learned the ropes, built a few things on the web and quickly found that people started using them. So, the work I did had real world impact - no matter how small.
That's when I told myself: "Yes, I want to be a programmer".