When you compile a C++ program the executable produced by the compiler is in machine code. Who determines how this machine code should look like, since the executable produced by a compiler on one OS differs for the executable produced by another (or even the same) compiler on a different OS?
This is how I started to think about it:
Code compiled on one operating system (for example Windows) can't run on another (for example GNU/Linux). An operating system is comprised of a userland and a kernel and runtime libraries somewhere in the mix. It definitely can't be the userland that determines it, so is it the kernel that determines how machine code looks like, but then again a kernel is only a program that allocates resources for other programs?
Sometimes it's defined by the processor architecture and sometimes by the OS, or a combination of the two. For example, there's the [UNIX] System V ABI for x86 and x86_64, and the C++ ABI for the ARM Architecture.
As for who picks which specification to use, it's largely up to the OS designers, although they have to follow certain rules specified by the CPU architecture, such as data in memory has to be aligned on 4-byte boundaries.
If you're asking about the instruction set, it's the processor designers who decide what instructions the processor will support and what the mnemonic for each instruction will be. Although processor design is a team effort so it's probably not literally the same person.