Why was my market order filled so far from the last trade price?

Stellar offers trading in any pair of assets, no matter how illiquid that pair. In an illiquid market, i.e. a market (pair of assets to trade) in which there may not be enough existing counter-offers to fill your order at a "reasonable" price, a market order will simply fill against whatever counter-offers are available, no matter how "unreasonably" far they are from the last executed price.

In illiquid markets (markets without a lot of orders), it is a good practice to avoid market orders entirely and just use limit orders.