The department used to be sometimes involved in national defense, so they called it the Department of War. When they started using it to exclusively create unnecessary wars, they had to change the name to the Department of Defense.
…it was created in September 18, 1947 as part of a reorg brought on by difficulties encountered during WWII. Pretty good foresight on their part to realize they were going to need to start a bunch of unnecessary wars!
It was 14 years before Eisenhower's famous speech on the military/industry complex. Maybe they were just incredibly prescient.
The tensions with the USSR that prefigured the Cold War had already began before the end of WWII.