The short but ahistorical answer is that topological string theories turn out to be examples of $(\infty,1)$-categories. The mathematical formulation of this statement is in Lurie's classification of topological field theories http://www.math.harvard.edu/~lurie/papers/cobordism.pdf (building on work of Atiyah, Segal, Getzler, Costello, Baez-Dolan, Kontsevich and probably a bunch more I'm forgetting.)
The content of this statement is that when you write down the axioms for a topological string theory, the collection of "boundary conditions" or "D-branes" look like the collection of objects in an $(\infty,1)$ category.
Of course, you can ask why the derived category of coherent sheaves. Historically, the answer to that is that it is very easy to write down a boundary condition for a holomorphic vector bundle in the topological B-model. It's not a huge leap from there to coherent sheaves, and if you start mumbling words like tachyon condensation, you can get to the derived category with a fair bit of hand waving.
That's from the physics side of things. On the math side, Kontsevich got there first, possibly by noting that the space of closed string states in the B-model ($H^\bullet(\wedge^\bullet TX)$) is exactly the Hochschild coohomology of the derived category of coherent sheaves. He then followed up by associating the (still not yet defined?) Fukaya category with the A-model and conjecturing that mirror symmetry is an equivalence of the two (with some Hodge structure goodies thrown in). Subsequently, it looks like you have to add in some things called coisotropic branes to cover all your bases, but the basic idea is right.
Kontsevich formulated all this in terms of $A_\infty$ categories which in the Lurie language turn into $(\infty,1)$ categories which are just TQFTs in disguise. So, Kontsevich's homological mirror symmetry is then the statement that two TQFTs are the same, just like mirror symmetry in string theory.
From the physics side of things, this was all a bit of a mess, but we now understand that the derived category really arises via Block's construction of the derived category (I'm being intentionally vague as to which version of the derived category) as arising from integrable super-connections of graded smooth vector bundles http://www.math.upenn.edu/~blockj/papers/BottVolume.pdf. You can see this explicitly in the physics from a few sources, particularly Kapustin, Rozansky and Saulina, and Herbst, Hori and Page, but I'm rather fond of my own contribution http://arxiv.org/abs/0808.0168.