[noun] + ではなかった / じゃなかった [na-adj] + ではなかった / じゃなかった
ではなかった is "was not" for a noun or a な-adjective in plain speech: the past of ではない. ない changes like an い-adjective, so ではない becomes ではなかった. It goes straight after the noun or the な-adjective.
to either makes it polite.
A な-adjective drops its な before では, as it does before だ.
An い-adjective makes its own past negative and never takes ではなかった.