Good comes from the Old English god, which had a long o sound so it would be pronounced like goad, and despite the similarities, it actually isn’t related to the word god. Well, at least not in terms of etymology. Anyway, the Old English god meant varied things like virtuous, valid, and desirable, so it was fairly similar to how we use it now. It can be traced to the Proto Germanic gothaz, which originally meant something like belonging together, and the Proto Indo European ghedh, suitable or to unite.
Now better has a verb form as well as an adjective one (to better oneself or something). The adjective comes from the Old English bettra/betera, while the verb comes from the Old English beterian, to improve. For the adjective, Proto Germanic gives us batizo and Proto Indo European has bhad, while for the noun, the first gives us batizojan and the latter gives batiz. Best’s history is closely related. It comes from the Old English beste (same meaning), which is a change on another Old English word, betst (if you try to pronounce that, you can see why the changed the word). Originally, beste/betst was the highest degree of the Old English bot, reparation. The words go further back, to the Proto Germanic bat and its higher forms batizon (better) and batistaz (best). And somewhere along the line, it switched from reparation to good, possibly because good never really had higher comparisons.
TL;DR: Better and best were adopted by good.
Tony Jebson’s page on the Origins of Old English