You cannot avoid the foam, it's going to form but you can keep it from boiling over. A foamy pot boils over because the foam traps steam, acting like a lid sitting right on top of the water. Escaping steam takes heat away from the pot, preventing it causes the water to super heat and boil over. You can prevent it by simply stirring, and floating a wooden spoon on the top (actually works).
However, I would prevent this by reducing heat. You don't need to boil your food, a simmer will work just fine and is more gentle on your ingredients, less heat means even with foam it won't boil over. So turn it down and solve your problem.
As for why the foam forms with mushrooms I don't know. With pasta and rice it's the starches on the surface which come off and expand, but mushrooms aren't starchy. I suspect it's other particles on the outside of the mushrooms, or perhaps the spores under the cap. To reduce foaming you could try rinsing the shrooms, that's usually a no-no but as you're cooking them in water it's no big deal. You could saute them separately if you have the time, you'll get a different flavor which you may prefer, although you wouldn't get it that way in a traditional Japanese curry.
Here's an article about foaming in pasta water which may be worth a read.