The origin of rings around giant planets remains elusive. Saturn’s rings are massive and made of 90–95% of water ice with a mass of ∼1019 kg. In contrast, the much less massive rings of Uranus and Neptune are dark and likely to have higher rock fraction. According to the so-called “Nice model”, at the time of the Late Heavy Bombardment, giant planets could have experienced a significant number of close encounters with bodies scattered from the primordial Kuiper Belt. This belt could have been massive in the past and may have contained a larger number of big objects ( M body = 10 22 kg) than what is currently observed in the Kuiper Belt. Here we investigate, for the first time, the tidal disruption of a passing object, including the subsequent formation of planetary rings. First, we perform SPH simulations of the tidal destruction of big differentiated objects ( M body = 10 21 and 1023 kg) that experience close encounters with Saturn or Uranus. We find that about 0.1–10% of the mass of the passing body is gravitationally captured around the planet. However, these fragments are initially big chunks and have highly eccentric orbits around the planet. In order to see their long-term evolution, we perform N-body simulations including the planet’s oblateness up to J 4 starting with data obtained from the SPH simulations. Our N-body simulations show that the chunks are tidally destroyed during their next several orbits and become collections of smaller particles. Their individual orbits then start to precess incoherently around the planet’s equator, which enhances their encounter velocities on longer-term evolution, resulting in more destructive impacts. These collisions would damp their eccentricities resulting in a progressive collapse of the debris cloud into a thin equatorial and low-eccentricity ring. These high energy impacts are expected to be catastrophic enough to produce small particles. Our numerical results also show that the mass of formed rings is large enough to explain current rings including inner regular satellites around Saturn and Uranus. In the case of Uranus, a body can go deeper inside the planet’s Roche limit resulting in a more efficient capture of rocky material compared to Saturn’s case in which mostly ice is captured. Thus, our results can naturally explain the compositional difference between the rings of Saturn, Uranus and Neptune.