Same as any prototype or sufficiently advanced aircraft like the F-117, pave the way for future generations like the Beast of Kandahar, demonstrate or invalidate a series of bold ideas.
In particular, the number of innovations crammed in the Zumwalt makes it relatively cost-effective from a "things we had to try" point of view: new low RCS hull, new composite bridge, new launch system (VLS), new centralised control systems (TSCE). All of this stuff can now be iterated upon and integrated in newer ships. That the new gun system has "failed" in practice is itself a lesson probably worth the dollars spent on it.
Not to mention: look up the name of its first captain [1].
There's few institutions that can do R&D with a multi-decade horizon and the armed forces are one of them. Is there waste in the process, sure, the ghost of Admiral Rickover must be turning in his grave, but it is not totally wasted, unlike a certain aircraft that is somehow manufactured in a full 45 states (have the remaining ones managed to get a piece yet, I haven't followed).
[1] http://www.public.navy.mil/surfor/ddg1000/Pages/bio1.aspx - shame the USS Enterprise was inactivated in 2012.