This is probably a slightly garbled account of the destruction of Shuri Castle in Okinawa. During the Second World War's Battle of Okinawa, the battleship USS Mississippi shelled the historical Ryukyu palace for three days prior to its capture by US marines.
At 0718 on May 25, the Mississippi began a murderous onslaught with her 5 and 14-inch guns that would last for three solid days.
- Craddock, Stephen Culver. "'To the Honor and Credit of chte Country': A History of the Warships Mississippi."The Journal of Mississippi History 54 (1992): 128-147.
In the end the castle was very much demolished, so it didn't exactly withstand battleship fire per se - at least, not for long.
But why did it take three days? Not to demolish the castle structure, but to bombard the entire extensive defensive position and the forces concentrated there. Shuri Castle is built on a hill dominating the center of town with high stone walls. The Imperial Japanese Army dug defensive earthworks on the castle grounds and built its headquarters under the ground, digging tunnels and expanding existing caves.
The Japanese forces defending Okinawa dug tunnels and expanded caves under Shuri Castle and its environs for their headquarters and command posts... The biggest tunnel served as headquarters for Mitsuru Ushijima, Commander of the Japanese 32d Army. This tunnel stretched some 390 meters north-south... The 62d Division expanded a natural cave under the Azana cliff as its headquarters. This installation ran under Shuri, Akata and the northeast corner of Shuri Castle... In summation, the ground beneath Shuri Castle was honeycombed with caves and tunnels.
Source: The Ordeals Of Shuri Castle
This is Shuri Castle today, rebuilt. The picture uses Google Maps 3D tilt view to give the scale of the complex and how the hill it stands on dominates the surrounding area.
The Shuri Castle after WW2.
The Shuri Castle today, reconstructed during the 1990s from old photographs and records.