The reason for this is simply to avoid discovery / FOIA requests, since messages delete.
Of courses it’s illegal, but the entire administration is operating as a criminal enterprise / an extension of all previous administrations, but in a way the most impressive disregard for rule of law we’ve seen.
FOIA doesn't apply to the Executive Office of the President. The NSC is covered by the Presidential Records Act, but its records are not subject to FOIA requests.