How do miners choose transactions?
https://www.coindesk.com/information/how-do-bitcoin-transactions-work/


  She then sends them from her bitcoin wallet out to the wider bitcoin
  network. From there, bitcoin miners verify the transaction, putting it
  into a transaction block and eventually solving it.


Transactions are broadcast over the P2P network, which miners are also a part of, so they receive the transactions from their peers.

Miners are completely free to do choose which transactions to include in the blocks they mine, but generally prefer to maximize revenue by collecting fees from transactions.