Why is this ceiling light fixture wired this way?
The cable on the left runs to the switch. Power comes in from one of the two other cables via red, runs down the red of the switch cable to the switch. When the switch is closed, power runs back along the black and into the light via the brown. Goes thru the lamp into the blue, which connects to the common neutral black of the other two cables.

Switch legs can be confusing because the neutral coloured wire carries power back the the switched fixture. All is as it should be though.