What Causes Whirlpools?

When two currents are trapped in between rocks or when two currents meet. Just like the rip current you don’t want to be caught in one not a lot of people knows what to do to get out from it.