It happens because the file you're visiting has changed on disk and there's a mismatch between what's in the Emacs buffer and what's on disk.
When you open a file, Emacs makes a copy in memory. It's not until you save the file that the changes in Emacs are written to disk. That is, the file is not locked during the editing process. It's therefore possible for an underlying file to change at the same time you're editing it. For instance, consider viewing a system log. A background process may update the log with new information while you're accessing the log with Emacs. If you tried to save, Emacs would warn you about the difference between what you see in Emacs versus what the log file now contains.
Saying yes
will overwrite the file on disk with what you see in Emacs. Saying no
keeps what is currently on disk. An alternative in this situation is to run write-file
, C-x C-w
, which is basically "Save as...".