I try to use regioneR library in R for permutation test. I get result, where z-score is equal to 79 or -90 and p-value is equal to 0.002 for both z-scores. Number of permutations is 500. I don't understand how those z-score and p-value are calculated.

So the p-value, here testing that the overlap (or whatever you test) is greater for the observed events compared to the randomly-permutated events, is the number of times that the observed event is larger or equal divided by the number of permutations.

The Z-score is the deviation of the observed events by the mean of the permutated events (corrected for standard deviation) so basically a significant event should have a large Z-score since the observed event should be quite different from the mean of the random events.

Did you check their publication?

regioneR: an R/Bioconductor package for the association analysis of genomic regions based on permutation tests

Yes, and there are no explanation why for different z-score there are the same p-value.

They are not the same z-score.