It's not a common accepted believe, just something that Eumaeus, the swineherd of Odysseus, says to his master while Odysseus is still in disguise.
Slaves, when their masters lose their power, are no longer minded
thereafter to do honest service: for Zeus, whose voice is borne afar,
takes away half his worth from a man, when the day of slavery comes
upon him.
Odyssey, XVII, 320
This observation of Eumaeus is quite poignant, as he himself is a slave: his father was king of the island of Syra, but he was abducted and sold to Odysseus's father, the king Laertes.
But there is no myth related to Zeus removing goodness of a man when becoming a slave. The passage you mention is just a poetical way in which Eumaeus complains about his condition, quite ironically, when he is about to prove his worth, aiding his masters Odysseus and Telemachus against the suitors.
The same quote can be found in this Wikipedia article: Slavery in ancient Greece, in Origins of slavery:
In the Iliad, slaves are mainly women taken as booty of war, while men
were either ransomed or killed on the battlefield. In the Odyssey, the
slaves also seem to be mostly women. These slaves were servants and
sometimes concubines. There were some male slaves, especially in the
Odyssey, a prime example being the swineherd Eumaeus. The slave was
distinctive in being a member of the core part of the oikos ("family
unit", "household"): Laertes eats and drinks with his servants; in the
winter, he sleeps in their company. The term dmōs is not considered
pejorative, and Eumaeus, the "divine" swineherd, bears the same
Homeric epithet as the Greek heroes. Slavery remained, however, a
disgrace. Eumaeus himself declares, "Zeus, of the far-borne voice,
takes away the half of a man's virtue, when the day of slavery comes
upon him".
This idea of "incompleteness" in slavery is also expressed in the opening lines of the ancient Greek comedy Wealth (Ploutos), where Aristophanes makes the slave Cario say this:
What an unhappy fate, great gods, to be the slave of a fool! A servant
may give the best of advice, but if his master does not follow it, the
poor slave must inevitably have his share in the disaster; for fortune
does not allow him to dispose of his own body, it belongs to his
master who has bought it. Alas! 'tis the way of the world.
Aristoph. Pl. 1