The “black box” (actually orange, to make it easy to see), is not indestructible. It is, or at least the part that contains the data recording is, pretty darn tough.
This is one model. The square boxy part at the left contains the electronics, and isn’t all that tough (the electronics are only needed *while* data is being recorded). The orange cylinder on the right (marked “ENREGISTREUR DE VOL NE PAS OUVRIR” – “FLIGHT RECORDER DO NOT OPEN”) contains the actual data recording device (this one is solid state, so the recording is on integrated circuits – more or less it’s a flash drive), and the cylinder is basically an armored housing for the data recording device. The silver cylinder at the far right is the underwater locator beacon.
(all images from Wikipedia)
If the accident is severe enough, things can get pretty mangled. Here’s some NTSB folks retrieving the recorders from the UPS 1534 accident. Somewhat astonishingly, data was recovered from both recorders.
This is the FDR from the West Air Sweden 294 accident. Again, all the data was actually recovered from this.
So they’re pretty tough, but they’re not indestructible. The recorders for the two aircraft (American Flight 11, United Flight 175) that hit the WTC towers on 9/11 were never found. Both recorders for the aircraft that hit the Pentagon (American Flight 77) were found, but the Cockpit Voice Recorder was too badly damaged to retrieve any data (although the data from the FDR was successfully recovered). Both recorders for the fourth 9/11 aircraft (United Flight 93) that crashed in Pennsylvania, were found, and yielded data, despite the CVR being buried 25 feet below the main crater.
In short, only a small portion of the black box needs to survive the accident, and that part’s built out of layers of metal and insulation and padding.