Question: Every time I go to break a block in Minecraft it opens the in-game menu.

I don't know how to stop this from happening, any ideas?

Answer: 
Try looking at your controls, I think that you have it so that if you left-click it opens the menu instead of Esc.
It's a Java bug. Try downloading and installing a different (newer, older, whatever) Java VM. As a workaround, hit more slowly, one click at a time. The bug seems to trigger when you hold the mouse button down for repeated clicks.