You might have cooked your garlic or mustard seeds or other spices too long. Black garlic will turn your sambar bitter, mustard seeds that got tempered for a tad too much can turn your dish also bitter. Also, try avoiding adding bitter-tasting vegetables such as bitter melon (aka karela). Of course, if you don't mind bitter vegetables then the choice is yours. To fix bitter flavors in your sambar, add a tsp or two sugar, which helps in balancing out the flavors. Adding a little more tamarind water or spices can do the trick too.