The first nuclear bomb test (Trinity) was of a plutonium bomb similar to the bomb dropped on Nagasaki. However, the first nuclear bomb used in warfare in Hiroshima was an untested uranium bomb. Why did the US military use the untested bomb type first? Who made that decision? And what was the purpose of Trinity if they wouldn’t lead with the proven bomb technology?
The question of "why was one done first" doesn't seem to have an easy, or at least a well-articulated, answer. It was just always the plan to lead with the uranium bomb, and the schedules for delivering the parts of the bombs to Tinian were arranged around that idea. One can speculate as to the various motivations that might have informed those plans, but I haven't seen anything "hard" about it.
One major consideration, which ties into your question about the testing of Trinity, is that the Little Boy bomb was assumed prior to Trinity to be the sure-fire weapon, and the bigger of the two bombs. The Little Boy bomb wasn't tested, but its design simplicity meant you could much more easily work out how explosive it would be, and you could do certain types of experiments that would (without a full explosion) give you an indication of how well it was likely to work. Prior to Trinity, it was assumed that Little Boy would be something like 15 kilotons (which it was) and that the Fat Man bomb would likely be at most around 5 kilotons, but could easily be less than a kiloton. So leading with your big, most reliable weapon seems like the smart thing to do, if you are going for a psychological effect, which they were.
Second, it is worth emphasizing that they did not intend to only drop two bombs. Groves thought it might take five or more bombs before surrender would occur. If anything they were surprised that two bombs seemed to do it (along with a Soviet declaration of war). So with the above in mind, consider their scenario: prior to Trinity, they could make a "big" bomb every two months or so (because Oak Ridge produced ~1 kg of HEU per day, and it took ~60 kg for a Little Boy style bomb), but they could make three "smaller" bombs per month (Hanford could produce ~20 kg of plutonium per month, and it took ~6 kg per Fat Man). So they'd start with a big bomb, drop three small bombs, then another big bomb, etc.
Which sheds some light on the importance of Trinity — it clarified both that the implosion bomb model worked at all (important for their production line, given how slow the HEU pipeline was compared to the plutonium pipeline. It actually gets even more important when you realize that they could mix Pu and HEU in an implosion bomb — so in fact, if implosion works, then you not only have access to much more plentiful Pu bombs, but you now have a production line that can use that HEU more effectively (because now you're producing something like 50 kg of fissile material per month, and depending on how you divvy that up you can imagine it being something like 5–8 composite bombs per month).
And Trinity revealed that the implosion bomb not only worked, but worked really well compared to their expectations. So the mindset shifted from "we have one big bomb and many small bombs" to "we have a lot of big bombs." And in fact Little Boy seems a little silly in this context: it was not as powerful as Fat Man, but it used 10X more fissile material to get the same explosion. The real question to ask is why did they drop Little Boy at all and in fact Oppenheimer suggested, the day after Trinity, that they should take Little Boy apart and turn it into composite bombs, now that they knew implosion worked so well. But this would set the schedule back a bit and Groves wouldn't stand for that, so Little Boy was dropped according to the original plan.
It is of note that the Little Boy bomb cost MUCH more to produce than the Fat Man bomb. 60% of the project funding went to Oak Ridge, which produced the HEU for the Little Boy bomb. There is evidence that Groves was VERY concerned with making sure that it looked like he had spent his money well. Could this have caused him to use the more expensive bomb first, as the one he knew would make the biggest historical "splash"? Potentially, though it is not clear. One scholar has argued that this makes sense of his push for two bombs to be used so rapidly — to prove that both forms of fissile material production were justified, and to make sure that both got used before the war ended. (For more on this sort of line of argumentation, see Stanley Goldberg, "General Groves and the meaning of Hanford," in Hevly and Findlay, eds., The Atomic West, U. of Washington Press, 1998.)
But anyway, as with a lot of these kinds of logistical questions, there isn't often a document we can point to that outlines the rationale. Maybe there was an elaborate rationale. Maybe there wasn't — there are only two options (either LB goes first, or FM goes first) and the order might have been as much about chance as anything else (if it was the other way around, the question would still stand). It is not something that is well-documented, and there is much about the use of the atomic bombs that people want to assume had a good reason for happening (since it seems in retrospect like such a momentous event), but scholars have found that, as one might expect, in the historical moment the various historical actors had a lot on their mind, and were unable to see the future, and made certain decisions based on hunches and inclinations without a lot of elaborate strategic rationale. The date of the second bombing raid, for example, was moved up a day based on the judgment of people on the island of Tinian because the weather for the intended day was forecast to be cloudy; even the use of a second bomb was more about them just happening to have one ready to go than it was some idea about what the effect of two bombs would be on Japanese psychology.
I wrote a piece last summer that probes some of these issues a bit, looking at a counterfactual question: What if the Trinity test had failed? It's a way to probe what the meaning of the test really was, and how it would have possibly related to the American position at the end of World War II, and beyond it.