Many of the comments here have focused around the skills and personality traits of coders. I agree with most: problem solving, some level of aptitude and curiosity are all important parts of the basic mix for success. Most of the discussion around motivation either has circled around economic benefits or some self-driven desire to learn.
Again, while not invalid motivators - I think a BIG one that's not been discussed is the general allure to the raw transformational power enabled by software (automation). With only a few lines of code, disruption can be created to make things easier, make things faster, make things safer, make things better - with immediacy and impact. In my case, I used it to disrupt inefficiencies and accelerate solving problems. As a factory process engineer, that kinda power was way too intoxicating to look away from. But manufacturing wasn't quite ready to embrace software quite yet - so I made the career jump. For me, I wish coding camps or other channels would have been accessible in small remote towns in the Midwestern part of the U.S. back then, it would have accelerated my confidence and given me a channel to seek a career. Instead the luck of the dotcom boom opened doors in job fairs where I had plenty to offer in the technical realm but little to show in terms of code at the time. Nevertheless, 15+ years and going in software has been a great ride thus far and one that I couldn't have predicted.
[1] https://medium.com/@boilerupnc/ten-lines-9a8403984bbf?source...
Yes I’m aware of the differences in capability and no I’m not complaining. I’m just saying it was easier back then.