Thanks for query.
It seems that he might got stretching of leg muscles and went into the spasm giving rise to this pain.
Going for only 2 times for swimming I do not thing chlorine has any role.
if pain is severe you may give some pain reliever with muscle relaxant
Ok and bye.