How can Polish law apply?
In Polish law a person can be prosecuted in Polish courts if one of these apply:
- a person is Polish and commits crime anywhere in the World
- a person comitted a crime against a Polish person of Poland's
- a person comitted a crime within Poland's border's
This is not unique to Poland at all. Most countries use that approach.
For a Polish person to be punished by Polish law, that person must break a foreign law that is also punishable in Poland. There used to be also a clause about a Polish person breaking foreign local laws not punishable by Polish law, but it was controversial and hard to implement. I'm not sure how this part looks now.