As an octagon has 8 sides, and an octopus has 8 tentacles, so an octave has 8 notes.
When you play scales - the 1st and 8th notes both sound similar and have the same name.
In this example there's an octave of C major - starting on middle C, going up to high C, then back to middle C again.