This happened to me for a while also before I had an idea of what was going on - here's an example of how something like this can happen - (if it matters, I'm on Windows, in case it's something specific to this build) -
Let's say you have a file that's encoded in UTF-8, and you paste some text from a website that's encoded with the Latin-1 or Windows-1252 code page, e.g. an O with an umlaut, or curly quotes.
Now you have a sequence of UTF-8 encoded characters followed by something which either doesn't make sense to UTF-8 or will possibly be misinterpreted. If it can't interpret it as a correct UTF-8 sequence it will display it as the raw value, e.g. octal \326 (which is an O with an umlaut in the Latin-1 code page). This is because to UTF-8, the \326 in particular is supposed to be followed by something with a 10 in the highest two bits, and if it's not, it doesn't know what to do with it.
E.g. if you were to go to https://www.gnu.org/software/emacs/manual/html_node/emacs/Intro.html#Intro and copy some text that included curly quotes, like "The `G' in GNU" and pasted it into a UTF-8 encoded buffer, you'd end up with "The \221G\222 in GNU".
So... what to do?
For one thing, you can look at the buffer with different encoding systems to see if it will display those characters correctly, e.g. Windows-1252 and Latin-1 are fairly common -
M-x revert-buffer-with-coding-system windows-1252 RET
M-x revert-buffer-with-coding-system latin-1 RET
If the document looks better this way, you can save it with this new encoding. There are a lot of different coding systems though.
To put it back to UTF-8, just do
M-x revert-buffer-with-coding-system utf-8 RET
As for why this happens, I'm not sure - it would seem that Emacs would know how something was encoded in the clipboard and translate it accordingly, but it doesn't seem to do this.
For some more explanation, see https://stackoverflow.com/questions/1543613/how-does-utf-8-variable-width-encoding-work and http://kunststube.net/encoding/.