Okay so you’re programming on Windows and you want to make a window with some buttons, text input boxes, checkboxes, [radio buttons](https://en.wikipedia.org/wiki/Radio_button), etc; a settings menu, let’s say. To make everything easy for the programmer and consistent across the OS, Windows provides these widgets to all programs on the system. An arbitrary program just needs to tell Windows “Put a checkbox with text label ‘Some String of Text’ at some particular place in this window”, and Windows takes care of how exactly that checkbox works (how it looks (animation maybe?), how it behaves (response to being clicked, text input, mouse hover, etc)). Then, a few lines down in the program, the programmer can ask Windows “What is the state of that checkbox I created a while ago?” and Windows will answer “checked” or “unchecked”. Or the programmer can ask for the value of a particular text input box and Windows will respond with the text contained in the box.
The programmer can also tell Windows stuff like “When this widget is interacted with in this particular way, run that particular function that I wrote”. So some programs just do that for every widget on screen, and save each change somewhere every time the user changes anything. Usually this is what’s going on when you don’t have to Apply or Save your settings. Each time you change a setting it gets autosaved right then and there. So when you’ve set everything how you want, just exit the settings window and you’re good to go.
But there’s a cost here. If the user is messing around with game controls, those settings don’t need to be updated in the game memory until the player starts playing again, so it doesn’t make sense to go through the effort of updating each setting each time it changes. And for some settings, like graphics settings, a lot of work/reloading has to happen in the background to apply your change. So it makes more sense to just have the user set everything how they want without their changes going into effect, and then give them buttons to actually enable all of these changes, with the understanding that clicking said buttons might result in several seconds (or, especially back in the day, minutes) of downtime while the game gets everything in order. The standard three buttons are “Ok” (apply changes and exit this menu), “Apply” (apply changes but stay in this menu), and “Cancel” (exit this menu without saving changes).
As computers have become more powerful and UI programming has become more flexible (at this point most games draw all of their own widgets instead of using the OS widgets), programs and games have started moving to autosaving by reacting to every UI event, and only use the Ok/Apply/Cancel scheme for things like changing graphics settings, since there’s no getting around that momentary black screen, or the possibility that the new settings will be completely unusable on your screen.
Latest Answers