If you have ever run an RPG scenario you may notice there are at least 3 things you need to balance quite precariously. 

Power a character holds, free reign so the player doesn’t feel stifled and giving the player enough rope to hang themselves with,

The story itself is a major factor but honestly trying to balance these three things can be a major task in itself. 

Some players decide this is a good way to unleash their inner psychopath (as selfish as I can be at times my characters show a surprising affinity for martyrdom which is probably an issue for my therapist)

Others try to play the true blue hero 

My last character Makett showed he could be a hero but he also had a willingness to kill which fit with the upbringing he had in the end he died to save his fiancée. (still again with the martyr complex come on brain unleash that inner a**hole)

I’m pretty sure Makett died while travelling his own story which brings me back to my actual point. 

When a GM or DM has crafted a story how do you keep characters there without breaking the players connection to their character,

This can be difficult especially as the power level grows higher. (I once ran a game of Scion and one character ended up bound to half of Manhattan while another player was using a truck to beat on another character the game is about godlike power so I should have expected this)

I hope you find a balance with your groups, I as ever will continue to try