The government created robot soldiers for their army. These robot soldiers were used to maintain order and defend planets. One of the scientists who worked for the government decided that he would attempt to provide one of the solider robots with human-like emotions. This scientist had observed that the current robot soldiers would kill humans based on success rates and efficiency, rather than empathy. He thought that programming human emotions into the robot would make the robot feel empathy in battle when forced to fight humans.
Shortly after he completed modifying the robot, the government discovered the scientist's experiments. The scientist was reprimanded, and told to destroy the robot. He seemed to comply with those orders. However, instead of destroying HAZMAT, he destroyed another robot that was the same model, and manipulated some documents and shipments so that HAZMAT was shipped out of the facility and off planet as part of a shipment of supposed hazardous material. Unfortunately for the scientist, the government also managed to find out that HAZMAT was not destroyed. The scientist was arrested and sentenced to life in prison for treason.
Many years later, the heap of supposed hazardous material was found by Tibs and members of the Motley Crew while they were searching for treasure. Tibs gets HAZMAT repaired and reactivated, and names him HAZMAT because he was found in a shipment of supposed hazardous material. He thinks of the captain as his savior and follows his orders absolutely.
HAZMAT has access to some of his memory of the past, and is able to pilot his ship based on those, but does not have complete access to all of his memories. He finds that he doesn't always have control over his 'new' emotions, and can actually get overemotional at times. His emotional vulnerability makes him an easy and tempting target for Zip.
HAZMAT realizes that he is underdeveloped emotionally, and sees how calm MOM is with dealing with everyone, so he assumes that she has figured out a way to control her emotions better than he does. Based on those assumptions, he asks her for advice and complains to her quite a bit. He does not understand that his emotions are unique from a robot standpoint.