A Public House was just that - people in Anglo-Saxon times would open their houses for hospitality to others to meet up during ale and socialise, which developed into the "pub" of today.
The "bar" was the demarcated area between the public and private areas, and also
an oblong piece of any solid material
which evolved into the place where you stand to order the drinks, and finally to the name for the place.
Tavern, according to https://www.thefreedictionary.com/tavern
Middle English taverne, from Old French, from Latin taberna, hut,
tavern, probably from *traberna, from trabs, trab-, beam; see trave
...that's a bit rough and ready, but no doubt others will improve on it!
Just to add that a "pub" is primarily a UK or Irish drinking establishment, usually a free-standing building, compared to a "tavern" which is more often part of a bigger building - like a row of shops. "Bar" is more commonly used for a drinking establishment in the US, but confusingly also as one of the rooms (the bar as opposed to the lounge) in a UK or Irish pub.