Doctor is one of the best trashers, and is a generally underrated card. Its swinginess is really what holds it back, but it's just so nice to trash your deck directly.
With any competent deck tracking in the early game, you can use it to somewhat consistently clear 2 cards out of your deck, with minimal impact on your current turn. The opportunity cost of most other Trashing cards is that it makes your current turn pretty bad, or nonexistent. The only real opportunity cost of Doctor is that it's a terminal action.
The overpay is huge, particularly on opens. If you hit $4 first, opening Doctor overpay is a reasonable move on some boards. You have a 40% chance of hitting an Estate; if you do, you've only got two left, and this makes the decision to name Copper or Estate on your next few shuffles generally much easier. If you don't hit Estate, you still get to trash a Copper and force a shuffle, though you'll either get a hand that can buy silver or a hand that can play Doctor reliably with $2 left, which is a bit awkward. ...Usually, there are better openers than this, depends on how much you need a thin deck.