It is decided by the individual agent initiating the transaction.
The most basic transactions are typically one or two inputs to two outputs which is due to the way Bitcoin keeps track of balances. One output to pay, one output to give change to the sender.
Unspent Bitcoin are stored in chunks, often referred to as "UTXOs." I like to think of it as lumps of gold consisting of various weights: you could have a lump that is 10kg or a lump that is 0.001 grams. When you spend Bitcoin, you have to spend the entire UTXO, but you can save the extra balance by "spending it" as giving yourself change. Imagine if you had two lumps of gold, 2kg and 3kg, and you wanted to pay someone 4kg. You would have to melt the two together, and then split it to be 4kg to pay, and 1kg to save. At the end of the process there are now two new lumps of gold. Bitcoin works in a similar way, spending money requires you alter the money you already have.
It is possible to have a single input go to a single output, but the initiator would have to have a UTXO/lump that was the exact amount that they wanted to pay someone.
At the end of the day you shouldn't have to worry much about these details as a user, your wallet software will handle all the UTXO selection for you.