Moving mail to folder removes it from mail account
It seems you created a local folder (On your Mac). If you create a folder in your Gmail account and point your rule to that folder. Every message will stay in your Gmail account.



You can also make rules in the Gmail interface. Then those rules will be followed on the server. If your Mac is turned off it will also move those emails to the right folder.