While using vi to edit an existing file, you are actually working on a copy of the file that is held in a temporary buffer.
If you invoked vi with a new filename, (or no file name) the contents of the file only exist in this buffer.
Saving a file writes the contents of this buffer to the permanent file, replacing its contents. You can write the buffer to a new file or to some other file.
You can also decide not to write the contents of the buffer, and leave your original file unchanged.