The meta question is: is every human being able to learn and do anything with a reasonable level of competency (subject to your definition of "reasonable"). I would like to think so. I would like to think that my own inability to do X stems from lack of perseverance, discipline, and/or hardwork. But I'm not quite sure of this.
I enjoy coding. Some of it has to do with having a reasonable level of competence; I'm not straining to understand everything. But there are a lot of areas of programming that I'm not well developed; I'm not able to grasp (as quickly) certain concepts.
There isn't enough said about embracing our limitations. This is goes against the optimism and can-do spirit of the American (or perhaps Western) ethos. But there is something to be learned from knowing oneself, measuring one's strengths and weaknesses, and then leaning into ones strengths.
There will always be the tension between overachieving because you actually have the ability to and being unable to succeed because you were a poor judge of your own skillset.
I don't know if you'll be able to acquire the skill of programming. Certainly age has very little to do with being able to acquire this skill. I myself have sat down and personally tried to help others to learn this skill. I've found that it isn't because of a lack of desire to learn. I remember starting with fundamentally simple models and then trying to connect it to the abstractness that is represented on a computer screen. It's very difficult for certain minds to make this connection. Or perhaps it was the lack of skill of the teacher.
In any case, I do hope you will be able to acquire this skill. I would also encourage you, though, to make an inventory of the skills you do have, the things you are good at already. Maybe putting more time in to things you are good at would be more fulfilling. Be true to yourself and remember that your ability to program has nothing to do with who you are as a person. I forget this sometimes.