In music, notes that sound an octave apart share the same name because they’re acoustically related by a 2:1 frequency ratio.
Two notes can share the same name but sound different because they're octave equivalents—versions of the same pitch class.
The E on your guitar's open 6th string (open low E) and the E on the open 1st string (open high E) share the same note name, yet they sound different (one "low", and one "high"). In music, we treat pitches that sound similar—like they "belong together"—as members of the same pitch class. Just as dark red and light red can both be called red, low and high versions of E are both called E.
This relationship between "same-name notes" is called octave equivalence. When two pitches vibrate at a 2:1 frequency ratio, the ear hears them as versions of the same musical identity.
The high E vibrates exactly twice as fast as the E that is "one octave" below (the E on the 4th string) because 329.6 Hz is twice that of 164.8 Hz. And that E note vibrates exactly twice as fast as the low E on the 6th string because 164.8 Hz is twice that of 82.4 Hz. That 2:1 ratio is what makes them sound related—even though one is much higher.