I’ve been thinking a lot about that myself lately…
What drives me is to provide value and code by itself has none. What does is using it as a tool to solve a problem. Sometimes you don’t need code to solve a problem; perhaps making a video will do it, designing a wireframe, talking to someone, sending an email, etc.
I used to get really excited about trying new technologies just for the thrill of it. Where that’s still valid, given you’ll likely learn something, it does not provide direct value. These days my approach is to learn by demand, keeping a list of topics ordered by priority.
I also think it depends on the project I’m working on. Starting a project from scratch usually is more enjoyable since the risk is lower and you have more freedom which can make things very enjoyable. But if you’re jumping into a five year old e-commerce project to fix a production bug that’s blocking users from buying something, things will be very much not enjoyable.