Can a full-time Ph.D. student legally work in a private company, and draw the stipend from the university and the salary from the job at the same time?
I am interested to know the regulations of Germany and Poland.
No. In many German contracts, it is explicitly mentioned that you are either not allowed to work anywhere else, or you need permission from your full-time PhD employer to work somewhere else. You can try to request but it will very likely not work.
If you get a PhD position in Germany, you will very likely get a reasonable amount to support your livelihood. It is, I've heard many times, the opposite in Poland. I do not know the legal issues in Poland, but I suspect it must be possible to work. Otherwise, how else are so many students surviving from the money they get from the state?