K-2SO, sometimes spelled Kaytoo Esso[5] or Kay-Tuesso, was a KX-series Security Droid originally created for use in the Galactic Empire’s armed forces.

At some point, however, the droid encountered Captain Cassian Andor, a member of the Alliance to Restore the Republic, a resistance movement that sought to overthrow the Empire and restore democracy. Andor was able to reprogram K-2SO to serve the Alliance.
Along with a band of roguish Alliance operatives, K-2SO went on a daring mission to steal the plans for the Empire’s moon-sized battle station, the Death Star.

Info by starwars.wikia.com