As with a lot of fermented/moldy foodstuffs I think the discovery of beer was probably a hunger issue. Stored food went "off" and I'm not eating that! was cast aside when nothing was left and starvation became an issue.
And a wonderful discovery was made...