When the bear wants in he’s getting in. Only real way to prevent it is to keep all food and food like things out of your car, which usually means leaving no backpacks or bags in the car, bears will even go after gum.
I find bears are polite and they usually try the door handles first. If you’ve never seen one try it’s amazing they lay on their backs and raise their arm, placing a front paw right under the door handle and just open it.
That’s why I always say it’s best to park with the doors unlocked and the front of the car pointing down a bit so when the bear opens the door it swings open and stays open. I’ve had bears in my cars several times and have only found a few paw prints and wide open doors in the morning as proof.
This isn’t so bad at least the bear made his own exit, when they get stuck in the car it’s a total loss, nothing shreds a car interior like a stuck bear. So in some ways locking your cars does minimize damage.