Background
B1-0781, also known as B1, is a memory-wiped Clone Wars era Separatist Battle Droid. Found by a junk hauler and sold around for years his body was eventually repaired and reactivated. Unfortunately for B1, he has no idea who or what he is. Told multiple times he was a simple killing machine, B1 refuses to believe that that's his purpose. Obviously he was made for far greater things.
When the Toydarian that repaired him grew tired of constantly needing to assure B1 that he wasn't his maker, he sold him for scrap on an out bound freighter. B1 was ecstatic to serve his new master, convinced this being was his original creator, and the one that will reveal his purpose. B1 would defend them to death, though it eventually turned out to be his owners death. B1 was at first saddened by this, but quickly realized if they died, and he still hadn't learned his purpose, then they couldn't have been his maker. He would travel on and find the one to give him purpose.
Whether he was mixed up with pirates, rebels, or one very scary Rancor tamer, B1 would always keep his owner safe for as long as possible. And B1 was very good at keeping owners alive. Well to be fair, a couple of them died from B1's own friendly fire, but that was hardly his own fault. They shouldn't have stood so close to the location B1 threw that grenade. But another dead organic, meant one less dead-end in his search for the reason he was made.
Motivation