ERC-20 (and ERC-20-like such as TRC-20, BEP-20, etc.) token balance of each address is stored in the contract of the token.
Blockchain explorers scan each transaction for Transfer()
events and if the emitter is a token contract, they update the token balances in their separate DB. The balance of all tokens per each address (from this separate DB) is then displayed as the token balance on the address detail page.
Etherscan and BSCScan currently don't provide an API that would return the token balances per address.
In order to get all ERC-20 token balances of an address, the easiest solution (apart from finding an API that returns the data) is to loop through all token contracts (or just the tokens that you're interested in), and call their balanceOf(address)
function.
const tokenAddresses = [
'0x123',
'0x456',
];
const myAddress = '0x789';
for (let tokenAddress of tokenAddresses) {
const contract = new web3.eth.Contract(erc20AbiJson, tokenAddress);
const tokenBalance = await contract.methods.balanceOf(myAddress).call();
}