She made it up, though possibly based on some historical drink. Since then, several people have tried to create various recipes (but at least ¾ of them are a cream soda base, which a) doesn’t taste like beer and b) I personally find to be yucky). Here’s one from Mugglenet (a big HP website), and some knockoffs of the Disney World attempt. Personally, I find these recipes, based on the historical drink Buttered Beere from Tudor history, to be the most likely options – actual beer/ale base, with some butter and some sweetening. And again, same idea, technically different recipes, in which it points out that any butterbeer recipe should have 2 ingredients: butter, and beer. Also, ‘The Accomplisht Cook’ and ‘The Good Huswifes Handmaide’ make me happy. ETA: Oh, and another!
ETA: Apparently, at the time of writing, JK Rowling was totally oblivious to the existence of historical butter beers.