Some tips which may help:
1. You may need to allocate more memory (RAM) for Minecraft to use (on default, Minecraft will allocate approx. 1GB of RAM). Make sure to check how much RAM your computer has available so you can allocate an appropriate amount. There are tons of guides online which can help you to do this.
2. Third party tools like OptiFine help graphics performance and chunk rendering. It's likely that when opening chests underwater, new chunks are generating at the same time causing timing issues. Once installed, configure settings appropriately (tons of guides online as well). The most important thing is to lower render distance enabling fewer chunks to be processed.