please help me understand the algorithm for selecting UTXO when forming a new transaction in Bitcoin.
For example, my wallet has a lot of incoming transactions (thousands of transactions in amounts of 0.001-0.09 BTC that have more than 70 confirmations and several transactions in amounts of 2-3 BTC that have 2-5 confirmations). When sending a new transaction in the amount of 1.5 BTC, the node for some reason creates a transaction with 500+ inputs for small amounts, thereby the weight of the transaction is 75 kb and, accordingly, the amount of miner's fees increases to enormous values. But if the node sent a transaction from an address that had 2 BTC, the miners's fees to would be minimal.
Please tell me how the node chooses which UTXOs to assemble a new transaction from? What settings on the node can regulate this?
I tried to find an answer on Google, but I couldn't find anything similar.