Question: How come the fee(cost) of Bitcoin transaction related to the processing speed?
You can set the fee/cost for your Bitcoin transaction as you want. thus it can even be zero for a transaction too.
But lower transaction fee will lead to longer processing time.
It is because the fee is relative to the number of bytes in the transaction, and Bitcoin’s protocol prioritize the transactions which have paid more fees for the community.
Transaction fees are used as a protection against users sending transactions to overload the network and as a way to pay miners for their work helping to secure the network.