The Latin for “eight” is Octo, from which we get the English Octagon.
Since most Latin words with a -ct- sound, like Octo, had the -ct- turn into a -ch- as the language evolved into Spanish, it is no surprise that eight in Spanish is ocho.
This same pattern manifests itself in noche/nocturnal, leche/lactose, and is one of our favorite patterns here at ForNerds!