The president is empowered to use the military without explicit congressional approval. There was a recent vote in congress on whether or not to reign this in, it failed.
"Senate Republicans vote down legislation to halt Iran war in Congress’ first vote on the conflict" https://apnews.com/article/iran-war-senate-vote-war-powers-0...
And the US has been talking around war with Iran ever since they were added to the Axis of Evil by GWB.
As for why, the obvious answer is distraction from the Epstein Files but apparently Trump just "had a feeling" Iran was about to attack the US and this was considered a "preemptive strike." Again, not at all outside of the MO of the nation that ginned up the Global War on Terror on entirely false pretenses.