The US earned this role in two ways. First, by being the one major country in the world that was relatively untouched by World War II (in terms of its industrial capacity). Second, by being willing and eager to take on the Soviet Union in the Cold War.
After WWII, most of the other major nations had been badly bombed, severely damaged by invasion, or both. This made these other major countries much less capable of affording a large military. It also mean those countries needed economic help, help that only the US was in the position to provide.
In addition, the US became a world superpower because it did not just sit back safely behind its borders. Instead, it involved itself in trying to prevent the spread of communism. This got the US involved in affairs in every corner of the globe.
America's industrial capacity and its Cold War willingness to get involved in the affairs of countries all over the world, made the US a superpower.