He resigned because he'd already had enough trouble as president. Mainly the Watergate scandal. His plan was for him to step down and if he was arrested the vice president which would then be the vice president would pardon him. Also, if he didn't resign he'd likely be impeached anyway.
The Watergate scandal led to discovery of abuse of power in Nixon's administration, which consequently led to an impeachment process. He decided it would be better to resign instead of waiting to be impeached. So basically these scandals piled up led to his resignation.