What's the function of public and private key in cryptocurrency wallet?
Bitcoin, as well as all other major cryptocurrencies that came after it, is built upon public-key cryptography, a cryptographic system that uses pairs of keys: public keys, which are publicly known and essential for identification, and private keys, which are kept secret and are used for authentication and encryption.
The private key is what grants a cryptocurrency user ownership of the funds on a given address. Thus, advised not to share with anyone.
You can read more about the private key and public key here:
https://support.blockchain.com/hc/en-us/articles/360000951966-Public-and-private-keys