If you are seeing the source code instead of the web page (when opened in the browser) then the file is not getting saved with the *.html or *.htm extension.
I don't have a Mac but I do remember some people say there is a TextEdit mode more specially suited to writing markup.
Originally Posted by Build Your Own Web Site The Right Way Using HTML & CSS (page 5)
However, we want to work with TextEdit as a plain text editor, so you'll need to adjust some of TextEdit's preferences. Start TextEdit, then select TextEdit > Preferences from the menu to bring up the Preferences screen. Select Plain text within New Document Attributes, then close the Preferences screen.
I suspect you'll have to alter the setting to something similar as described.
It sounds like the file extension is incorrect as xhtmlcoder is saying. In OSX go to Finder, preferences and there should be an option to shown known file extensions I think it is. (at work on horrid XP so I can't check for you). You probably have a scenario where is making "filename.html.txt" and its using the txt extension.