2013 BMW X1 shifts into park

,

car put gear shifter in drive take your foot of brake and it goes in to park and same thing happens in reverse
any help is highly appreciated
thanks
dalip

The car did this by itself?

All by itself?

Sounds like you are not wearing the seat belt and the door is open, the gear shift control module thinks that you are getting out of the vehicle. Is the door ajar light on?