Not to be confused with equipping weapons while swimming,
Steps to reproduce:
1. Find some water
2. Open your inventory
3. Drag an item, and hold onto it
4. Move into the water and start swimming
Holding an inventory object just before swimming, closes your inventory, but keeps the item held in your cursor, making the icon float around while you swim. Can be fixed by just re-opening the inventory on land and putting the dragged item back
A possible fix would be to either just drop the item, or put it back in your inventory whenever it is closed.
This may be closely related.
Thanks to scareactor#5665 to letting me know about thi