An optical fibre mainly consists of two layers: Core and Cladding.
Data travel through the inner layer which is consisting of central hollow material is known as core which is denser. The core is covered by a less dense material known as cladding, the outer layer. Both the cladding and core are made of glass or a plastic.
The purpose of cladding:
It is necessary to keep the light reflecting in core instead of being refracted, because we need it to pass on to destination from the source. Thus when light enters from denser material into less dense material the cladding so it changes its angle, it reflects backs the light in core. This is the reason that the core is denser and outer layer is less dense.
Or in other words, the core has a higher refractive index than the cladding, which surrounds the core. The contact surface between the core and the cladding creates an interface surge face that guides the light, the difference between the refractive index of the core and cladding is what causes the mirror like interface surface, which guides light along the core