It's because your mind is trying to fix this and it's an unresolved issue for you.
Imagine the following (this is very loosely based on a real life person I once knew) -
A woman walks down a street at night, a bit drunk. She would be classed as vulnerable to most people. She's unusual in that she actually wants someone to steal from her. A man, a thief sees her and takes her belongings. She feels like she's got what she deserves, as she partly wanted this as a form of extreme self-harm.
This illustration is not to suggest to you that you wanted this from him, not at all. It's for you to think about that scenario, and ask yourself is he not a predator because he happened to encountered that woman, and not someone else? His intention was to mug someone that night. That's what he thinks has happened., he's quite pleased with himself with the wallet and phone he got from her....so does it matter what was going on in her head, in that case? Do you think it would be ok to let him go unpunished? That he's not dangerous or that he won't potentially mug someone else again?
He apologised after which also confused me
That's because like the thief in the above scenario, he knows he's done wrong (and it's questionable if your 'friend' is really sorry or if he's trying to do damage control). You were confused, because at that point you were still processing what had actually occurred between you.
The penny's eventually dropped that he knew what he was doing, and you were in more danger than you realised. It took you by surprise partly because you had your guard down. After all, it wasn't like he was a total stranger, you'd built up some rapport at that point.
You did the best you could at the time, with a circumstance that would have been confusing, scary or alien for a lot of women, especially if you're a young woman. 💐