Keypad Application Mode
Terminals have a feature named Keypad Application Mode (the mnemonic for the command that enables it is DECKPAM).
When Keypad Application Mode is enabled the numeric-keypad keys send function-key escape sequences so they can be differentiated from the digit keys along the top of the main keyboard and used to perform other functions (e.g., cursor movement, scrolling, editing text).
This mode is described in the DEC VT100 terminal user guide here:
DECKPAM – Keypad Application Mode
The input sequences are described in tables 3-7 and 3-8. (The specific sequences depend on other terminal state.)
Overriding to Enter Decimal Digits
Typically, a Num Lock key can be used to override this mode to enter digit characters, and several terminal emulators have a preference to ignore this mode and always send digits.
Since not all keyboards have a Num Lock key, macOS Terminal—for example—also has a Num Lock menu item and by default it maps the keypad Clear key (which is physically located where Num Lock often is) to Num Lock. The Num Lock menu item also has the keyboard shortcut Command-Clear ⌘⌧ to make it available from the keyboard if the Terminal keyboard-map preference has been customized and Clear does not map to Num Lock.
Programs That Cause Problems
By default, Vim enables Keypad Application Mode but does not map the function-key input to anything, which means that the trailing part of the function-key escape sequences are entered as text. Similarly, the Zsh “Oh My Zsh” collection may enable this mode without mapping the keys to something useful.
In programs like these you may see text entered or the program may beep and/or enter nothing. As far as I am aware this should be considered a bug in the program that enables the mode.