as someone who loved maths first but then do programming for a living, it's because solving puzzles is fun. I get the same dopamine hit whether it's a math problem, a coding task, or a video game level. but I think forcing yourself to like something is not the correct approach; you either like it naturally or you tolerate it for some other goals