According to various dictionaries, probably comes from the German or Yiddish word for boy. It's very informal. Be aware that nowadays in the US, it used just as often mock friendliness when you are being passive aggressive with someone as it is in actual cordial situations.
Also used as a term of endearment by some parents.
2. Elsewhere in the world, in the movie "Whale Rider", which takes place among the Maori tribe in New Zealand, all the kids, boy and girl, refer to each other as "bub" constantly, as do their relatives.
3. Additionally, it can mean "baby" in slang over there.
2. Come on bub, you can do it.
3. I've been up with the bub since 2 AM, she won't stop crying.