[noun] + ではなくて / じゃなくて [na-adj] + ではなくて / じゃなくて [verb (plain)] / [i-adj] + のではなくて / んじゃなくて
ではなくて says "not A but B": it denies A, and the right answer follows straight after. It goes after a noun or a な-adjective, and じゃなくて is the spoken form.
To deny a whole action or description, put の in front – ん in speech: のではなくて, んじゃなくて.
Without の, the verb's or adjective's own なくて just links two clauses, usually as a reason – "because it didn't" – and the correction is lost.
ではなくて is also the て-form of ではない, and like any て-form it can link a cause to its result: "it isn't X, so…". What comes after decides the reading. A reason is followed by a feeling or a consequence; a correction is followed by the right answer.