The "fungus" is actually a slime mold, which has the scientific name Fuligo septicai, is also sometimes called "scrambled egg fungus". It is most likely to show up during warm, wet periods, sometimes seeming to appear out of nowhere overnight. And it didn't come from your dog.
Dog vomit fungus, like other slime molds, are most often found in moist, shady areas, where they thrive. Crevices, mulch, rotting logs, and leaf litter are all very common places to find it.
Slime molds like the "dog vomit fungus" produce spores that are wind-borne. They are very resistant, and can survive even during hot, dry weather. They are very often brought to the property with imported mulch. The spores can remain viable for several years, waiting for conditions to be just right. Then when warm, moist conditions are present, those dormant spores absorb moisture and crack open to release a swarm sphere, and shortly after, gardeners will see that tell-tale, disgusting looking fungus appear.
Typically, dog vomit fungus poses no threat to plants and lawn. It's really just an unattractive nuisance. The best way to control it is to break it up and dry it out. Dog vomit fungus growing in mulch or leaf litter can simply be raked out and disposed of in your regular trash. If you have it growing in your lawn or on plants, gently scrape it out as best you can and get rid of it. A strong spray of water will also dislodge any of the remaining fungus still clinging to the plants (though it could appear again later).
If dog vomit fungus continues to be a problem, you may want to consider switching from wood-based mulches to something else, such as gravel or one of the rubber-based ground covers. In general, it typically doesn't pop up often enough to be a real issue.