CS2 is a nonpolar molecule because it is composed of two carbon atoms and two sulfur atoms. The carbon atoms are bonded to each other by a double bond, and the sulfur atoms are bonded to each other by a single bond. The electrons in the CS2 molecule are evenly distributed, and there are no regions of positive or negative charge.
White phosphorus is also a nonpolar molecule. It is composed of four phosphorus atoms that are bonded to each other by single bonds. The electrons in the white phosphorus molecule are evenly distributed, and there are no regions of positive or negative charge.
Because white phosphorus and CS2 are both nonpolar, they are able to dissolve each other. When white phosphorus is added to CS2, the nonpolar molecules of white phosphorus are attracted to the nonpolar molecules of CS2. This attraction is strong enough to overcome the intermolecular forces that hold the white phosphorus molecules together, and the white phosphorus dissolves.