I noticed a very strange phenomenon. I printed the exact same gcode once via SD card and once via Octoprint. When printing via SD card, the mainboard fan goes out after printing and not via Octoprint.
You said it's the mainboard fan.
Is it activated in the start gcode? Or is it temperature controlled?
There is usually no gcode for controlling a mainboard fan.
the mainboard fan starts turning as soon as the first stepper motor starts moving. It's just not clear to me why if I print the same gcode via SD card that the fan then goes out after successful printing and not via octoprint
Just to be sure : the fan you're talking about is in the control box ? Not the fan located near the hot-end, nor the one in the power unit ?
As said by @Ewald_Ikemann, there's no gcode to control fans in the control box or the power unit. Hypothesis : it is probable that the manufacturer of your printer has embedded in their firmware a detection to shut down the fan when the printer start idling, which is detected when the file on the SD Card is fully read; Octopi will not send such a thing, and so it will not trigger the fan shutdown.