How did Joseph inherit Hamon from Jonathan? I was watching JoJo's Bizarre Adventure and on the episode where Jonathan dies, Erina takes a random child.

When Part 2 started, how did Joseph "inherit Hamon from Jonathan" if he isn't directly related to him?
He inherited the Hamon ability from

 His mother, Lisa Lisa. She is an expert in Hamon. Well, since they have another Hamon's user other than Joseph in his family, the percentage Jonathan inherited the Hamon's is quite huge. Also his father, Goerge Joestar II was the son of Erina Joestar. However, George Joestar II did not inherit Jonathan's Hamon ability. Instead, his son, Joseph Joestar, had the ability of Hamon.

But from Wikia, it stated that he got Hamon's ability from

 Jonathan Joestar.

 The young Joseph developed early an ability to use the Ripple inherited from his grandfather, first displaying it when Speedwagon was being kidnapped.

Here is a video on YouTube when he used Hamon for the first time
A user from the JoJo's Wikia page explains that too.

 His father is Jonathan and Erina's son, George II. Lisa Lisa is the one who isn't related. Though I expect having some of Lisa's blood helped with learning it faster.