Kate apparently went in the "wrong tunnel" and sees Alejandro holding a corrupt cop at gun point. Since they had just shot their way through the drug mule tunnel, what surprised her to cause her to pull a gun on Alejandro? It was obviously a big plot point as subsequently Matt (Josh brolin) explains the whole CIA plot to her.
She doesn't know what Alejandro is, but she knows they're in Mexico, they've no jurisdiction whatsoever and she's just seen Alejandro hold a criminal at gunpoint, force him into a car and demand he drive him. She doesn't know what his motives are, but doesn't trust him and so doesn't lower her gun.
Kate is trying very hard to do things by the book. She works for the FBI and in the film becomes increasingly concerned that the team is working outside of their jurisdiction. However, the very reason she and Reggie are part of the team is to give protection to the CIA unit. From the script:
REGGIE: What the fuck is he dressed for?
MATT: Relax. You guys will hang back when we get there, k?
REGGIE: Then why are we going?
MACY: Because CIA can’t operate within US borders without a domestic agency attached. Right? At last. She gets it. He smiles.
MATT: Hey. All the drugs we find, you guys get to confiscate. Gonna be a big day.
He walks off.
MACY: That’s why we’re here. That’s the only reason.
As they proceed through the tunnel, Reggie gets spooked, but Macy needs to continue to understand why they're there:
REGGIE: Fuck are we doing in here? Let’s go back.
Machine gun fire erupts. The fight has begun.
REGGIE (CONT’D): We’re in fucking Mexico!!
MACY: THEN GO BACK.
Macy finally reaches the end of the tunnel she's not supposed to go down:
MACY (O.S.): WHAT ARE YOU DOING??
Alejandro turns and sees Macy, her rifle trained on him.
ALEJANDRO: Put that down.
MACY: STEP AWAY. I mean it. Move away from him.
He looks at her.
The automatic fire from different tunnel shafts rushes in and out like blasts of hot air.
ALEJANDRO: We are in Mexico now. You have no jurisdiction.
MACY We can’t be here
--Alejandro raises his pistol and fires six rounds into Macy’s chest.
After that, as you correctly explain, the whole CIA plot is explained to her.
I've highlighted the relevant section in the passage above. Macy is completely out of her depth. At the start of the film, we see her operating in a house with bodies hidden behind every wall. She's supposed to be a tough, strong, powerful agent. But even with all those qualities, she's still completely out of her depth in this team.
She's told to stay away from this particular tunnel, that she doesn't want to know what's at the end. She has to know. So much has been kept back from her. And as she goes, she sees Alejandro hold Silvio at gunpoint, force him into a car and tell him to drive him.
Macy is terrified by this. As the highlighted line above shows, she's highly aware they're not in Mexico and have zero legal jurisdiction. She doesn't know if Alejandro is CIA or enemy. She doesn't know anything - except that this man has crossed into Mexico, is holding a criminal at gunpoint and demanding he drives him.
Macy doesn't deal with these things in her usual job. She makes arrests. She demands he steps away, with her gun trained on him, just like an agent is supposed to do in these situations. However, she is distracted by gunfire and shot herself.