Put the issues to running .... if it happened when you were running you would examine your diet, if you had tried something new or eaten later than normal et.c
You would look to see if you have changed anything ....
Drunk too much, drunk too little
Look at posture ...
Taking in too much air
Tied your laces too tight .. (ok maybe not this one)

All these things apply to swimming, the reasons dont have to be complicated just because its water based
My guess would be if it is lasting this long that it is likely to be postural/muscular .... are you relaxed when swimming?