When the character does something that falls outside of what you've planned or what they've done before it's in most cases a sign that the story/character is telling your things should change.
Or, to use psychological language, it's not the character that's acting or the story that's talking, of course. It's likely your unconscious. It has, as it tends to do, picked up some hints that something in the story doesn't work, can be improved, or should be done differently from what you've planned.
In most cases, it's a good thing. However, sometimes it can also be due to tiredness, fear (e.g. doing comedy where there should be dark drama), or just plain old procrastination.
The main thing to remember is that your first draft is a first draft, meaning it's a suggestion of what the final book might become.
The good thing is, you don't have to make all decisions now, just keep writing, if you go completely wrong and have to backtrack put the new material in a separate document for later review and give it another try.
But if you can keep going, do that. You will be surprised by what you think of the story once you've finished it as compared to what you think of it now.
Just keep going. Postpone all "bug fixing" to editing.