Doing what your character would do it the opposite of bad roleplaying.

It might, however, be a bad way of playing a roleplaying game.

First, you do have some control in how your character will behave, particularly when you are creating it. In a lot of cases the problem is making a character who won't get along with the rest of the party or the DM's campaign. That you are playing the character how they were intended is not the issue, the issue is bringing such a character to the table in the first place.

There is also the issue of your characters fidelity being more important than the other players enjoyment. For example, maybe your paladin would kill the party assassin, but is the discomfort caused by your having to play your character wrong more important than the (presumably much greater) discomfort of the assassin's player needing to die and reroll? This of course goes both ways, which is why party creation needs to have a serious element of communication and compromise.

Likewise the DM needs to temper verisimilitude with the setting with the players enjoyment. It might be realistic to lock a PC thief up in a dungeon or cut off his hands, but that likely won't be fun for the player. Likewise if the party is captured by the pirates they weren't sent out to battle there is a good chance the pirates will do some very unpleasant things to any female party members in a realistic game, but very few DMs in their right mind would actually have such consequences as the discomfort it puts the players under far far outweighs the benefit of having true to life villains.