I think this is an old, and popular, puzzle.

The key is the total time of the fly in flying.

Here the average speed it flies is 15 km per hour. So if the fly flew in one hour altogether, back and forth, then the fly would have flown 15 km.

The fly flies until the two people meet.

The two people are 20 km apart. They drive towards each other at 10 km per hour each.

So when they meet, how many hours elapsed?

Without using formulas, they meet after 1 hour. (Each one covers 10 km when they meet. Their speed, each, is 10 km per hour, so, they drive for one hour only until they meet.)

That means the fly flies in one hour only, for whatever number of turnings it has to do.

So, the fly would have flown 15 km when the two people meet.

------------

Like I said, your question is an old and popular puzzle. I take no credit from giving this answer. I just pass it around.