This is because in the ancient Roman calendar, October was the eighth month of the year. The Roman calendar originally started in March, making October the eighth month.
Later, when the Roman calendar was reformed to start in January, October retained its name despite no longer being the eighth month.