I find it hard to believe it was for scientific interest. Was it a display of power?
The nuclear tests of the USA fell into several categories:
Weapon innovation. The US developed 70ish different types of nuclear warheads for its arsenal and explored many other approaches that were not used. These ranged from slight variations on a theme to radical new weapon designs. Knowing that the weapon would at all, work as intended, work reliably, work under the imagined conditions of use, etc., required testing. And not just "test it once" testing — repeated testing helped build a more comprehensive understanding of how a given warhead might behave, and what variance there might be in that behavior.
Weapons effects. What happens to a plane if it is a given distance from a nuclear weapon? How about a tank? How about different type of buildings? How about human skin? How about food and beverages? "It go boom" is neither correct at certain distances, nor useful. If you are imagining actual fighting a nuclear war, or surviving one, you need to know more about the effects, both because you want to know about how you are going to use your weapons (e.g., how big of a weapon do you need to take out a given target?), but also what to expect if someone wants to use a weapon against you (how deep should you build that bunker?).
True science experiments. Nuclear weapons use extremes of heat, pressure, and radiation that are not comparable to much else on Earth. This can make them somewhat difficult to understand from first principles: you can think you understand what might happen to, say, uranium at millions of degrees C, but do you really understand? Many of the tests, esp. in the underground years, were about understanding fundamental questions of weapons physics, so that overall understanding of weapon design and maintenance (especially for a possible period without nuclear testing) could be enhanced. To put it another way, you can't have a reliable computer model without knowing if the physical model is right, and when it comes to the kind of physics in a nuke, the devil is in the details: get a small thing wrong, and you get a big thing wrong.
Note that any given test series, and sometimes any given test, could satisfy a number of the above motivations. There are a few other categories one might include above too, like weapons reliability (take a random warhead from the stockpile, test it, see if it behaves as you expected — usually it does, occasionally there are surprises).
Was a display of power sometimes part of these tests? Yes. Sometimes quite explicitly. The Operation Crossroads tests of 1946 were very much meant to be a "display" for the world — they even invited the Soviets to witness it! But they were also effects testing. There are other such examples, and one can argue that any test is, to some degree, a display of power. But if you're asking if that was the only motivation — no. Not for the US, anyway. There are some tests of the USSR that were of dubious scientific value, but even then, the scientists probably got something useful out of them. They're clever like that.
The US and the USSR both tested about the same number of weapons, but they also fielded huge numbers of weapons. Other states tested far fewer, but also fielded far fewer. This is not to say that one must test a lot to field a lot, but if you are fielding weapons with a lot of variation, then yes, you must test a lot. Stopping testing means reducing variation, as a corollary: this is why, in the interest of halting the nuclear arms races, there has been so much pressure on ceasing testing.