This can only be done if the author of the original application or game has given permission, often in the form of a license. Open Source licenses normally include permission to create and distribute modified versions of the software -- that is mush of the point of making the source code available in the first place. Proprietary apps may not include source code, and might not have permission to create or distribute modified versions.
I cannot find any indication of the specific license under which the Google Camera application is or has been distributed, so I cannot tell if the many people who have posted ports and modified versions are doing so with Googel's permission, or are just counting that Google will not bother to sue. I did not find any news about Google issuing cease and desist warnings, of filing copyright infringement suits over this software, which suggests but does not prove that Google is OK with such modifications.
The same rules apply to any application or game, and indeed to any copyrighted work such as a novel, play or video. If soemoen creates a modified version that is a derivative work, and that is copyright infringement if done without the permission of the copyright holder. Distributing a sensitive work also requires permission.
In a US-based suit, fair use can be a defense against an infringement claim, but a significant modification of an entire application will not often pass the four-factor test for fair use.
Few if any software applications have been around long enough for their copyrights to expire.
So in general one needs permission to create and distribute modified versions of apps. It is entirely up to the copyright holder whether or not to grant such permission. If one creates and distributes such a modified version without permission, the rights-holder could choose to sue. If the court finds that infringement occurred, damages could be awarded for all losses (including losses of potential markets not yet developed) to the rights-holder, and all profits, if any, made by the infringer. In some cases statutory damages may be awarded instead, with no proof of loss. these can range from nominal to quite large. Costs of suit and legal fees may be included, if the court thinks proper.
Copyright infringement is rarely treated as a crime, except when a commercial product is massively copied without permission. Widely distributed bootleg CD and DVD operations are sometimes treated as crimes, for example. Aside from such cases, copyright infringement is a civil matter, and nothing happens unless and until the rights-holder chooses to sue. This means that sites which host infringing content are not usually "taken down" by the authorities, although in some cases they may be included in infringement suits and forced to pay damages along with the actual infringers. Sites which comply with "safe harbor" rules (like the DMCA in the US) are generally immune from suit for infringement as long as they followed the rules. Safe harbor is not available in every country, and the rules vary from country to country.
The details of copyright law vary from country to country, as do the procedures for bringing an infringement suit, and the exact proof needed to win or defend a case. 'Fair use" is a specifically US legal concept, and will not apply in the courts of other countries. But the general outline of copyright is much the same in all countries that adhere to the Berne Convention, and that is all but a very few countries in the world as of 2019.