Trump himself claimed the US don't need the Strait of Hormuz, as they produce lots of oil themselves, and he said 'other countries should clear the Strait'. Nevertheless, also inside the US oil prices are rising and this is not favourable for Trump and the oncoming midterms. It's a stupid move from Trump instigated by Kuchner, Witkopf and Nethanyahu.
The broader picture is that China is/was supplying weapon components for oil to Russia, Venezuela and Iran, and is competing with the west with cheaper energy prices. What happened in Venezuela, diverting the oil to the US has embolded Trump.
He shouldn't have gone to war, he should have gone after the shadow fleet worldwide. Europe should have done the same, though they stopped some tankers with Russian oil after Trump did the same with tankers coming from Venezuela. All to little and to late. International law shouldn't protect dictators smuggling oil and other commodities to finance themselves and stay in power.