OK, there's *a lot* of things wrong with this episode. The first is that STTOS was never intended as a comedy show. But here we have a great comedy episode. Secondly, the star of the show should never be made to look silly, but Kirk's dignity is trampled underfoot by this furry, toothless creatures. Even Spock normal stoicism is undermined by the events of the epsiode. But none of that matters. Because "The Trouble with Tribbles" is simply one of the best-written TREKs ever.
Underlying the comedy stylings of the Enterprise crew and the Klingons is a tautly plotted, clever story. The Tribbles aren't just in there for the laughs, they're integral to the plot and in the final reckoning, the little blighters save the day.
And that's why the script got past Gene Coon's office and made it into production.
If you can find it, you should look out David Gerrold's book "The Trouble with Tribbles: The Making of a TV Episode" as it has far more info on how the show got made than I have time or space for here.
But along with "City on the Edge of Forever" this is, for entirely different reasons, the other best TREK episode of all.