This is what is known as a linear-quat algaecide and they are prone to foaming. They are inexpensive and you get what you pay for. If you must use an algaecide, PolyQuat 60 is much better to use, doesn't foam, is very effective, and is also a clarifier as well. It is more expensive.
As for your foaming, it will dissipate over time as the algaecide will slowly break down from chlorine. You can shock the pool with higher chlorine levels if you want to get rid of it faster, but this is not necessary as it will go away probably in about a week (two at the most).
Read the Pool School to learn how to manage your pool without the need for extra algaecides, phosphate removers, clarifiers or other products -- just chlorine (bleach or chlorinating liquid) alone and possibly some acid for pH adjustment.