When you press a key, the keyboard controller sends an interrupt signal to the kernel
The kernel will then send the appropriate information to a program like XKB, which will perform a corresponding action (type a character, move left, etc.)
Unlike most keys, the fn key almost never has a hardware scan code
Instead, the fn key is wired directly to a hardcoded microcontroller inside the laptop.
Because it's unknown to the kernel, there's nothing you can do at the operating system level to remap this key (sadly)
Some laptops will actually have a built-in method of changing fn behaviour (usually with limit options) in the BIOS