Actions consume resources. *Took* here is used to mean *consumed*:

> Filling the hole *took* 12 bags of soil.

> Driving to work *took* half a tank of fuel.

> Beating the last level of the game *took* five attempts.

> Finding out *took* ten minutes.

Sometimes it makes sense to specify *who* consumed those resources:

> Filling the hole took *Ted* 12 bags of soil.

> Driving to work took *Alice* half a tank of fuel.

> Beating the last level of the game took *you* five attempts.

> Finding out took *me* ten minutes.

Since "Filling the hole", "Driving to work" etc. are noun phrases, we can replace them with the pronoun *it*.

> *It* took Ted 12 bags of soil.

> *It* took me ten minutes.

But now that we've lost that detail, we may want to put it back in:

> It took Ted 12 bags of soil *to fill the hole*.

> It took Alice half a tank of fuel *to drive to work*.

> It took me ten minutes *to find out*.

In speech, you might have already spoken "It took me ten minutes ..." before realising that you need to explain what "it" is, so you add it on afterwards. That's one reason a "backwards" form of the sentence exists.

Another reason is that it it allows you to emphasise one part over the other. The "taking ten minutes" part is the focus of the sentence, and what gets the listener's attention.

Written English mimics spoken English.

-----

There is a subtle semantic difference between these two:

> David took 10 minutes to find the notebook.

> It took David 10 minutes to find the notebook.

In the first, David takes 10 minutes from his "supply of time", in order to find the notebook. David is *giving* his time to the activity.

In the second, the activity of finding the notebook, takes 10 minutes from "David's supply of time". The activity is *taking* time from David.

-----

Although it's not the question, for completeness: "all of ten minutes" is a stock phrase meaning "ten minutes, which I consider to be a very small effort; you could have done the same".