So, how did this shift took place and what were the reasons for the emergence of USA as the pioneer in these fields leaving behind Europe and other countries?
Other answers point to World War 2. The US's rise in science, technology, engineering, and mathematics started prior to WW2. I'll start with the pre-WW2 developments follow through to the end of the 20th century.
The US's rise in engineering started with the birth of the country. At the very start, American interests saw the advantage in interchangeable parts and its subsequent offspring, mechanization and the assembly line. This came to forefront in the late 1860s in the Chicago meatpacking industry and in multiple places that manufactured arms for the American Civil War. This dominance became apparent in 1913 with Henry Ford's Model T.
The US remained a backwater in the sciences until the mid 1930s. (The US did however produce some remarkable astronomers prior to this time.) What happened to the US in the 1930s was fascism in Europe. Germany was the world leader in much of the physical sciences throughout the 19th century and up until the mid 1930s. Fascist laws forced many of those European scientists to emigrate to the US. The list includes Hans Bethe, Albert Einstein, Enrico Fermi, John von Neumann, Leo Szilard, Edward Teller, Stanislaw Ulam, Eugene Wigner, and many others. It's dubious whether the US would have been able to build the bomb without those European scientists.
World War II was a great impetus to US dominance. American engineering helped build the massive amounts of machinery needed to sustain that war effort, and the European scientists helped build the two machines that ended that war. In the immediate aftermath of that war, the US extracted 1500 German scientists, engineers, and technicians via Operation Paperclip, including Wernher von Braun. It's dubious whether the US would have been able to send men to the Moon in the 1960s without the help of those German emigres.
In the meanwhile, WW2 devastated much of Europe. The US built machinery and technology while Europe struggled to rebuild its basic infrastructure. This advantage continued and grew for decades after WW2 ended.
Also, is there a possibility of similar shift from USA to other country say China and India?
The US developed the concept of the assembly line automobile manufacturing, enabling the US to dominate the automotive market for over half a century. That early dominance set the US back later on in the 20th century. Late 20th century American cars were nowhere close to best of class. Asian and European automobile manufacturers became better at making economical cars, luxury cars, and everything in-between compared to their American counterparts. So, yes, there's a precedence for a shift from the USA to elsewhere.