Now that you've stopped and jumped in the water and turned your board over, you can see that the fin is still there, and just fine. There are three causes of spinout, and even more ways to cure it. If air can get at the root of the fin, it can be drawn into the low-pressure flow on the windward side and lead to a stall. Whatever the threshold, any nicks, dings and other surface imperfections will bring it closer, and increase speed-robbing drag as well. The third cause is a fin that doesn't match the conditions.
Technique has a lot to do with it, too.
I find that in most cases this alone will allow the board to correct on its own. As you get better, you will find yourself becoming very familiar with the sensation of the fin just as it is about to begin to spin out. There is a moment before the spin out when you can feel the fin lose force against the water. If you act quickly to remove weight from the fin just at the moment when the force of the fin is lost, the spinout will correct before it even happens. The idea is to force the fin back to the direction you're going and re-establish smooth flow around it.