First thing I want to mention is that the anime is a bad thing to use to determine how good a Pokemon is. The anime and the games are completely different, so what is good in the anime might be awful in the games and vice versa. A prime example is Ash's Pikachu, who makes Pikachu look like a fantastic Pokemon - that's not the case in the games. That said though, Ditto happens to be a fairly ordinary Pokemon in the games, at least in the competitive game. Obviously Ditto's usefulness often comes down to what it can transform into, so that's one thing to consider before reading this.
So I'll cover what Ditto does well first. The main thing it does well is being a revenge killer who is able to stop sweeps, even if the opponent's stats have ridiculous boosts. Impostor copies the opponent's boosts, so it has just as good of a chance of winning as the opponent does. To avoid speed ties, every Ditto set uses Choice Scarf, which guarantees you'll move first in most situations. If Ditto manages to win, you keep the boosts you copied from the opponent, which can allow you to sweep the opponent's team if they don't have a Pokemon that can beat you. These unique qualities mean Ditto can save you from being swept by your opponent and turn it into a threat to hyper offence teams.
Ditto sounds like a good revenge killer and potential sweeper if it can copy boosts, but its usefulness pretty much stops there. Besides its revenge killing capabilities, Ditto isn't a very good Pokemon. Its first problem is that it is very one dimensional. The only viable set is has is its Choice Scarf set, which makes it very predictable and simple to play around, especially since it'll be locked into a move due the Choice Scarf. Without a Choice Scarf, Ditto is much less useful as it risks a speed tie, which could have a bad result. The Choice Scarf also means Ditto can only afford to switch into offensive Pokemon, since defensive Pokemon won't appreciate being locked into a passive move like Toxic. You also have no control over what you transform into. If you didn't use Ditto, you'd be able to choose a Pokemon for the team slot, who you can then support with the rest of your team. However, you can't do this with Ditto, as you don't know what Pokemon it'll be transforming into each battle. This makes Ditto very hard to build a team around, because you don't know what Pokemon you'll be using.
Another problem with Ditto is that you may not get the moves you wanted when transforming. There are many Pokemon that have multiple sets that have different moves, some of which would be great on Ditto but others might not be. Take a Pokemon like Heatran, for example - it can use Choice Scarf, specially defensive, offensive and other sets. If you are going to copy Heatran because you want an offensive set, it could screw you up if it happens to be a defensive variant. Ditto also risks copying a Pokemon that walls itself - for example, if you copied a Steel type whose only attacking move was Iron Head, you'd be in trouble since your opponent completely walls you. Because of this, you need to stay away from lots of Pokemon since you can't do anything back to them, which decreases the amount of Pokemon that would be useful to bring Ditto into. Ditto also keeps its own awful HP stat when transforming, which removes a ton of its bulk and makes it a lot worse.
There are many Pokemon capable of revenge killing that don't suffer from the issues that Ditto does, so often it is outclassed. If a Pokemon that you choose can do the same thing as Ditto just as well, then why rely on luck to get a good Pokemon to transform into with Ditto? It's usually better to choose your Pokemon and build a team that supports it rather than use Ditto. Unless your team has problems with many common set-up sweepers, then Ditto is usually outclassed.