How can public key not reverse encryption if the algorithm is known?
I will give you the simplified answer.

The public key encryption does not prevent adversery from computing private key from public key. It just makes it very very very hard. The algorithms use math that allows simple private->public calculation, but public->private has no good mathematical "shortcuts". It would take adversery more time to calculate this, then for him to walk in front of every home on Earth, and beat every occupant inside with a rubber hose while asking about content of Your message.