A chain ID is a number that identifies a particular network among Ethereum and other Ethereum-compatible blockchains. Ethereum mainnet is chain ID 1; each test network, layer-2 network and EVM sidechain has its own value. EIP-155, activated on Ethereum in late 2016, added the chain ID to the data covered by a transaction's digital signature.
The change was a response to the split between Ethereum and Ethereum Classic, where the same signed transaction was valid on both chains. Including the chain ID means a transaction signed for one network is rejected on another, preventing a replay attack. Wallets read the chain ID from the node they connect to, show users which network they are on and refuse to sign for the wrong one. Signed-message standards such as EIP-712 include it too. Community registries such as Chainlist record which IDs are in use, since nothing technically stops two networks choosing the same number.
Ref 1070001316