By default, Mathematica only saves notebooks following a user’s explicit action (e.g. using the menu item File ► Save or the keyboard shortcut Ctrl+S).
However, to help protect against accidentally losing any work, Mathematica can be set to save a notebook automatically after every evaluation by setting the NotebookAutoSave option accordingly.
To enable autosaving for all notebooks in Mathematica, change the NotebookAutoSave option setting in the Option Inspector to True in the Global Preferences scope.
Note that a notebook must be manually saved to the machine once before autosaving with NotebookAutoSave begins.