Fictional characters aren’t real. So it seems weird that they can be uncooperative or surprising to their writers. How can it be difficult to write about a character doing anything, anything at all, when no matter what you do it’s always just words on a page, fingers on a keyboard? Sure, some options might be more compelling than others, but why can it be difficult to write in the first place? How can characters possibly rebel against their writers and take over the story?
Here’s a question that will provide an answer: What is the answer to x+y=z? Well, it can be anything. All of the variables are undefined. So let’s put in 2,588 for x and say that z is 7,986. Off the top of your head, what’s y? I can’t tell, even though I was the one in charge of the variables from beginning to end. By filling in x and z, I’ve already determined what y is, but I can only make a vague guess that it’s in the neighborhood of 5,000-6,000 before I actually bust out a calculator and solve the problem (turns out: 5,398). Or I could’ve done it by hand, if I wanted to be masochistic about it.
The important thing is, characters can be the same way. Sometimes you’ll be writing a character having planned on them doing one thing, and then when you get there you’ll realize that doesn’t fit the character you’ve established at all. When a character “rebels,” what’s really happening is the literary equivalent of needing y to be over 5,500 and realizing when you actually punch the numbers in that it’s not, and that while you are physically capable of writing down “2,588+5,501=7,986,” that’s wrong and you know it and that’s uncomfortable. You can go back and change x so that it actually will equal z when you add it up with y. You can change y so that you reach your original intended ending of z through a new method. Or you can stick with the x and y you have and just figure out what z you end up with at the end. What you can’t do is write down the wrong answer. Unless, I guess, you’re a hack. Then it probably won’t bother you as much.