K-2SO is a KX-series security droid, originally deployed by the Galactic Empire and reprogrammed to serve the Rebel Alliance as an insertion agent. He was created for Rogue One: A Star Wars Story (2016) and performed through motion capture and voice by Alan Tudyk.
Where he came from
The Empire deployed him on Ghorman during the massacre at Palmo; a member of the Ghorman Front rammed the droid with a transport, splitting him apart, and Cassian Andor took the pieces to the rebel base on Yavin 4 to be rewired. It is the most literal statement of Rogue One's method: the Rebellion is built out of things the Empire made and lost track of.
The comedy is structural
"Congratulations. You're being rescued. Please do not resist." He is funny because he has no social calibration whatsoever — he calculates odds out loud, tells Cassian exactly what he thinks of Jyn, and delivers the crew's grimmest assessments in a flat, helpful register. In a film with no comic relief anywhere else, he is load-bearing.
The death
He holds the door in the Scarif data vault so Jyn and Cassian can finish, and his last line is the closest thing the film has to a declaration of love: "Jyn, I'll be there for you. Cassian said I had to." He returned in the second season of Andor (2025), which fills in the Ghorman origin the film only implied.