You can read more about this https://bitcoin.stackexchange.com/questions/35697/what-is-cr..., but the TL;DR is when the txs are broadcast by various nodes, the highest fee txs are included first (for the most part) by the miners.