I don't know about you, but this happens to me more often than not. I try to write a scene, and I can just be going along, fine as you please, until SOMEONE just GOES OFF and does something I ABSOLUTELY DID NOT PLAN ON, something I never even thought of until the very second they pulled a monkey wrench out of their own BUTT and threw it into the works. And this can be either a good thing, or a bad thing.
I know, I know; how could a wrench pulled out of a butt be a good thing? Well, it can give you inspiration, maybe that little bit of extra excitement, extra plot substance that you needed. How would you have know the Count was actually the MC's long-lost brother who married the MC's ex-girlfriend if your secondary character hadn't wandered over to that old mill and found all those buckets of paint?
On the other hand, it might not give you anything, and it might just confuse and stump you. There is really no point to the MC wandering around in that library, he's supposed to be in a bar fight right now, he'll never get there in time, how do I get him out of here without this being totally pointless? Do I have to delete everything I just wrote?
But what's even worse than characters that run around like toddlers with ADHD is when they WON'T. DO. ANYTHING. You don't know what it is, but they're really upset about something, and they're giving you the silent treatment. Is it their name? Their job? Their personality? Their background? Their home life? You don't know yet, but until you fix it, you can't make them do diddly squat. Nothing they say or do seems right. Their character is flat and lifeless, like a sad little stick figure.
I--what's that you say? I'm the author, I created and control these characters, I should be able to make them do whatever I want? *laughgigglesnort* yeah, sure, whatever.
While it's true that we have some measure of control over our art, oftentimes our subconscious takes over, and takes us to places we didn't expect. We try going in one direction, but our minds paint a picture of something else, even if it's something just a little bit different, and we can end up going in a different direction--or at least, taking a long time to get to where we wanted to go in the first place. Maybe our detour has a pertinent point, or maybe not. But we have to explore it to find out.
And sometimes, there is one small aspect of our character that we're not quite 100% in love with, and we try to convince ourselves that it's OK, but we can't seem to throw ourselves into that character's role and bring them to life until we change that aspect.
So you see, in some sense, our characters control us.
That being said, what can we do when these things happen? Well, I like to roll with it. Go to that underwater jousting arena, bored businessman! Change Happy-Fred-from-the-coffee-place-down-the-street to Ghalahagen-the-Bold-who-has-a-crippling-fear-of-moths. Build a bonfire on the school roof to signal those aliens that really weren't supposed to be a part of this story. See what happens.
On the other hand, it's equally acceptable to reign your characters in. Make them stay on dry land and go to that boring meeting where something actually awesome is going to happen. Make Happy Fred's tragic backstory WORK for him. Keep those kids off the roof and immersed in their tween drama like they're supposed to be. As long as YOU love your characters, and YOU love your story, then that will come shining through your words, and everyone else will love it, too. :)