Calculating a nth root is easy. It's about multiplying large prime numbers.
Each number has only one prime factorization. 23 * 7 = 161, and there is no other pair of integers (besides 1 and 161) you can multiply to get 161.
If you use two really huge prime numbers you get a really huge result. There are long lists of really huge prime numbers for this purpose, and multiplication is cheap.
But if you have the result of the multiplication, there's no easy way to find the original pair.
In RSA, the public key is that result, and the private key is the original pair. If you use the result to encrypt a message it can only be decrypted with the original pair, and you can safely give people that result.