Actually, a byte could and did have a variety of bits as they were generally hardware dependent. Generally, a byte is the smallest number of bits that a hardware can process. The most popular bytes early on were 4 bits and especially 6-bit bytes.
https://en.wikipedia.org/wiki/Byte#6_bit
Octets ( 8 bit bytes ) became widely adopted after IBM went with octets in the 1960s and the industry basically followed and octets became so ubiquitous that byte and octet became synonyms. It's similar to how google became a synonym for internet search ( "you can just google it" ) or how coke became a synonym for soda in parts of the world.
So while it is widely accepted that a byte is 8 bits, but technically, it isn't true. Octets are 8 bits and most/all bytes in the world are octets. But it doesn't necessarily have to be so. Octets always have to be 8-bits, but a byte doesn't.