Grain has quite a bit of lactic acid producing bacteria in it, on top of it's just being readily available in nature in general, so breweries naturally have a ton of it around. Most common lacto and pedio bacteria, the primary two type of LAB, is not very tolerant to hops. If you make a really hoppy beer, this naturally helps prevent the beer from souring.
Of course, a lot of beer is intentionally soured by these, and basically all beer originally would sour, and it's perfectly safe to drink. Just not desirable in every style of beer.