I had a similar problem. Some of my kegs still had seven up syrup in the bottom when I got them. I cleaned and rinsed them and then filled them with beer thinking i had washed them enough. Wrong ended up with a pale ale with a serious seven up flavor. Actually it was sort of good, but anyways U used oxyclean and really hot water to scrub the keg and then a really diluted bleach solution to soak the kegs for about a week and it finally took the flavor and smell out of it.
another place that bacteria and other bugs can build up is in the dip tube and the posts. I think it is a good idea to periodically take the keg apart and clean those parts as well. Especially if it is a new keg that could have been sitting with syrup or some other solution in a hot warehouse for months or years.