What likely happened is, your car is either in hold mode or creep mode, and you expected the car to go into park which it does not in all cases, instead of putting the car in park yourself.
Thats a "you" issue (not putting the car in park).
Similar to what happened in this very recent thread in the model 3 subforum:
Hi Carole! Welcome to TMC. I’m fashionably late to the party but just wanted to say welcome, and thank you. Even with the unfortunate damage done, this has been a great thread to read. Your enthusiasm and willingness to better understand the car is super, super refreshing. Makes me jealous...
teslamotorsclub.com
Specifically, post #4 in that thread has an excerpt DIRECTLY from the tesla manual:
I parked my Model 3 on my level driveway this evening, opened my drivers door and as I put my foot out of the car to exit, it shot forward into the wall, and rammed the open drivers door into my daughter’s car which was alongside, slamming the door onto my foot which was now very painfully...
teslamotorsclub.com
The above is a link to that post, and to save time in case you dont want to click the link, here it is, screenshotted:
View attachment 772025
Specifically it lays out what has to happen for the car to go into autopark AND SPECIFICALLY says " It is the drivers responsibility to always ensure the vehicle is in park before existing.
Never rely on Model 3 to automatically shift into park for you. It might not work, in all circumstances )for example, if creep or a slope causes the vehicle to travel greater than approximately 1.5mph.
So This is 100% a result of the OP not putting the car into park or "expecting" the "car to do it for me".
The specific "full and complete" answer to the question of "what happened here?" is " You didnt put the car in park, and it rolled away".