Why do golfers get bad knees?

Twisting and loading. Golfing requires a fair amount of twisting movements. If you walk a hilly course, this can make your knees sore. However, the literature on injury patterns does not identify golf as a sport that has a higher than normal proportion of knee injuries although it can happen, especially in golfers with slightly abnormal knees to start.
Overuse injury. Most likely it is due to overuse, but it could be due to a lot of different reasons. Have it evaluated by a professional and get the appropriate treatment.