There is a 'unit' inside your key that when queried sends a serial number to the cars computer so that the vehicle can start
It is sort of having a password on a PC and trying to crack that
Yes a mobile locksmith can program in new keys into the cars computer. They will demand that you show them the title, insurance and your ID and all three better match.
The cars these days have more computers and control circuitry than what went to the Moon!