I'd call it a rocker panel, and it looks bwoke. Shouldn't be too expensive since it's plastic, though that's relative.
As to "why" it comes off, well, probably just because parts come off. I doubt it was intended to come off, but it looks like you drove over something, like a curb, and pulled it loose.