I can only speak for AA as I used to work there so unsure about other airlines.
If the boarding pass is scanned for the wrong plane, a red do not board pops up and says wrong flight, so that shouldn't be possible unless the computer glitched. If the seat was already scanned used, then even if the pax tried typing the seat in manually it was say that the seat is not vacant... again unless of some glitch.
I'd say by far the most 2 likely scenarios would be either confusing gates after scanning BP and going to wrong plane somehow. If not that, another very likely option is gate agent wasn't properly paying attention and somehow allowed someone to get by them without scanning their boarding pass.
Sadly it does happen a bit more than you think will a pax will actually fly to the wrong place somehow, only finding out when they are pretty much already there.