such a RSA algorithm.
The short answer is that what makes primes useful is that it is easy to multiply two primes, but difficult to algorithmically factorise a given number into prime factors (i.e. takes a long time, if the number is big). So multiplying primes is an operation that is easy to perform but difficult to reverse. That makes them a perfect candidate for implementing public-private key encryption.
A long answer would involve explaining RSA, which has been done in lots of places and you will have no difficulty finding them. You need to know Fermat's little theorem to understand how RSA works.