When you finally get why a bug is what it is, sometimes it's because you didn't understand how something worked. Debugging helps track down what's not working in your code, but also helps track down what's lacking in your knowledge, and what's wrong with your process.
When you come across something that doesn't work the way you expect it, figure out why you didn't expect it and it may increase your knowledge.
When you find that your bug comes from some oversight or laziness, then you need to figure out if you can adjust your process so that it makes it harder to happen again.
Debugging leads to clean code, not just code that exists now, but code that you will write in the future too.