I'm not a parent.
If I had an iPad/MacBook around, I'd sit with him and work through the Playgrounds-app Apple has for helping kids learn to code. Within the app, there's a bunch of games. You can start with Learn to Code 1 which starts off with lessons on commands, then continues to functions, for loops, conditionals, logical operators, while loops, and finally algorithms.
A couple of summers ago, a bunch of my friends developed a teaching curriculum for a summer camp. We used Lego Mindstorm to teach kids how to program code.
We also had a class where we introduced the kids to a Raspberry Pi, then installed a program called SonicPi which was then used to teach programming by playing a synth with code.
We also used Google's educational material to teach basic MachineLearning that used a computer's webcam and kids taught the machine to run a function when it recognized a facial expression or something like that.
Surprisingly, one of the cool ideas that did work was teaching the kids basic Blender, then 3D printing their models. We also had a super basic game development class that used Scratch to make games.
MIT's Scratch is very versatile, it shows up alot when you look for guides to get kids into coding.
You know, you can also just play board games with him. I don't know what it is but folks who grow up to be good at coding always seem to have anecdotes about playing games with their dad. I guess DnD helps kids develop their cognitive skills, like thinking logically and abstracting large concepts, both of which helps lay the foundation for getting your kid to be a good problem solver.
All in all, as long as the two of you are able to enjoy the time together and repeat the sessions regularly long term, it will work wonders for him. Sons need their fathers.
You got this,