For each case inside Pega a unique id will get generate and Pega will store that id in pyID property. pyID is Pega OOTB property and we will not put any custom logic for populating this property value inside case.
For each table we need to have a primary key and pyID will be the primary key for all cases. By using pyID and Class combination pzInsKey will get generated inside Pega.
Please refer below mentioned articles for references.
In online when you are doing money transfer, for each transaction you will be getting a unique transaction id and this transaction id will be the primary key. You can use this unique id to fetch particular transaction details alone (or) if you are having issues in transaction then customer care member will ask you to provide the transaction unique id, by using this unique id they will be able to get all needed information related to the particular transaction and start their investigation.
In Pega this unique transaction id will be the pyID.