We are familiar with the way we classify our solar system planets, terrestrials and gas giants or Jovians.
- Now, both of them had a very different childhood. They even changed their orbital distance! Jupiter and Saturn used to be much, much closer to the Sun, almost where Earth and Mars are located. Jupiter's formation opened a gap in the planetary disk, which separated the planetesimals into two regions. When Jupiter and Saturn got interlocked in planetary resonance, only then did they start moving outward (that also gave the opportunity for the inner planets to form in the first place), which we call Planet Migration. They also even drifted apart from each other.
- The massive size of Jupiter and Saturn were influential in sweeping up matter in the Jovian disk and also in capturing other planetesimals from outer but eccentric orbits. The movement of Saturn to the more outer region caused it to sweep much more matter than Jupiter, which had a limited supply.
- Saturn kept capturing planetesimals and forming moons. Some of its moons also came too close to the planet (specifically at the Roche limit of the planet) and got tidally stripped of their mantle, which formed the rings.
- Neptune and Uranus formed later, so they didn't have much matter left in the disk because of both high solar winds stripping the planetary disk with matter, and Jupiter & Saturn sweeping up matter too. And that could be a plausible reason why Neptune and Uranus have lesser moons (lower mass than other Jovians and less matter to accreate).
This is, of course, a very basic picture, and the reality is much more complicated, especially when you throw in dynamical friction, turbulence, gas stripping, magnetohydrodynamics, etc. But I hope this will be enough to get the basic idea.
Feel free to comment if you have any doubts.
Edit: Here are some references which I used to get the perspective of this.
The last reference shows a different but prevailing theory.