TextEdit
TextEdit is a basic text editor on Macs.
Issues
The main issue with TextEdit is that by default is often saves as "Rich Text Format" rather than standard text (which is what we usually need). To stop this, go into TextEdit's Preferences and click Plain Text (rather than Rich Text), and unclick the Smart Quotes and Smart Dashes options. Make sure you make a new page after doing this.
A good replacement for TextEdit, with much more functionality, is BBEdit, but you have to buy it.