The 'on_initialize' function for each Substrate runtime module is called via the Executive module, which handles all of the top-level stuff; essentially just executing blocks/extrinsics.
Every time a block is executed (execute_block), first initialize_block is called which ultimately calls the 'on_initalize' block for theAllModules type:
<AllModules as OnInitialize<System::BlockNumber>>::on_initialize(*block_number);
The AllModules type is a tuple of the different module identifiers in your runtime. It generated by the construct_runtime! macro and lists the modules in the order you defined them in the macro