The minimum gas value for a transaction is 21000 (e.g. simple Ethereum transfer).
Any additional (such as calculations / read /store /... operation) will incur additional costs.
These operations should be priced according to the cost they impose on node operators. From the Whitepaper:
The intent of the fee system is to require an attacker to pay proportionately for every resource that they consume, including computation, bandwidth and storage; hence, any transaction that leads to the network consuming a greater amount of any of these resources must have a gas fee roughly proportional to the increment.
The main cost drivers for regular transactions are the cost of storing data in the chain (SSTORE with 5000/20000 gas) and reading data from the blockchain (SLOAD with 100/2100 gas).
Below are some ressources about EVM Opcodes:
- EVM Opcodes: Description
- EVM Opcodes: Cost
In your example, transferring an NFT requires multiple writes to storage (e.g. when the owner of the token is updated). This makes this transaction much more expensive than a normal Ethereum transfer.
The gas cost of operations (opcodes) are repriced periodically (e.g. to avoid spamming).
https://eips.ethereum.org/EIPS/eip-2929