The Carriages come from Fort Neugrad, it's possible Lokir was imprisoned there awaiting execution.
Possible this.
Probably because the dragonborn is unconscious, so they didn't have a chance to ask you who you were. And didn't much care.
Or this.
They probably had the names of all the Stormcloaks. If you look, you can see the prisoners from the other cart being lined up the same way the the ones on your.
Two other things bugs me, though:
First, where do all the prisoners come from? On your cart, there are only you, Lokir, Ralof and Ulfric. On the other cart, I can see four prisoners - three men and a woman, I think. One gets executed - three left. Then we have two wounded soldiers and one attending them in that first tower you run into.
If you follow Ralof into the keep, you'll find the dead Gunjar there - it IS possible he's one of the guys from the first tower. But then you run into two other soldiers in the dungeons, a man and a woman. And now it's getting weird, since I'm alonst certain it's ANOTHER woman (blond, middle-aged) than the one who were waiting to be executed (who, if I recall correctly, has brown or possibly auburn hair). I'm not sure if any of the male soldiers on the cart looks like the one in the dungeons. Also, the ones you meet down there seem fine, not wounded at all. Oh, now I feel like I've got to check this...
Next, Hadvar refers to the captured Stormcloaks as Ulftic's "top lieutenants". But non of them wear officer armor, non are named except Ralof, and Ralof seems to be an ordinary footsoldier - he talks about how he has been promoted after Korvanjund (if you side with the Stormcloaks), and when you meet him later, he complains about that Galmar probably doesn't know his name. Hardly a high-ranking officer.