How OP_CHECKSIG knows the source of sig in pay to pubkey hash transaction https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29

The last step of pay to pubkey hash transaction is to check the signature of the previous transaction tx hash  and pubkey .

But how the script interpreter knows the sig is the signature of the previous transition hash, what if the sig is the signature of some other content?
But how the script interpreter knows the sig the signature of the
  previous transition hash, what if the sig is the signature of some
  other content?


It also compares the signed data with the transaction hash itself. In general, this is how digital signatures work. If the data isn't signed by the right key, and data hash doesn't match, then the signature is invalid. See src/script/interpreter.cpp L#1264.

This verification process ensures two things:
1. The person has the private key which corresponds with the public key provided.
2. The data has not been tampered with.