Sometimes it'll happen if you used a proper noun (e.g. a person's name) or at the beginning of a sentence -- but then later deleted it.
For example, let's say I was going to text:
"I'm meeting Chris at Oakland park tomorrow."
But then I backspaced and wanted to change it to:
"I'm meeting Chris at the park tomorrow."
Because I manually pressed shift to capitalize "Oakland" the first time, the iPhone will remember that I intentionally did so, and set the shift key for the start of that word.
In retyping it, it would look like this:
"I'm meeting Chris at The park tomorrow."
Notice how "The" is capitalized, even though it's not the start of a sentence? The reason why is because I manually capitalized "Oakland" originally and it thinks I'm going to keep it a proper noun, when in fact, "the" is not a proper noun. I would have to either take it off shift, or erase the word as a whole for it to go away.
Hopefully that makes sense!