What causes chafing between the legs while swimming?

in my case i am a male and the area between my scrotum and inner thigh gets red raw after swimming ,so now i use hair removal cream twice monthly to remove the coarse hair and put vaseline on before swimming.i swim about 6 miles a week and now have no problems