On the Apple App Store, as well as the Android Store I’m sure, there are a number of legitimately totally free apps and games. Free to download, free to use/play, no in-app purchases, no ads whatsoever. They’re relatively rare but they’re out there, and many of them are actually good quality.
What do the developers of these apps get out of it?
It varies quite a bit. Ask ten developers and you’ll probably get ten different answers.
Some people like creating apps as a hobby. Some like to feel that they are giving back to the community. Some like bragging rights. Some are padding their resume. Maybe they are in school and want to be a professional app developer, so they release some apps for free to show what they can do. Others might be just showing what they can do as leverage for a paying job (I made X, Y, and Z, hire me and I can make a similar app for you, for example).
There are probably a few that have malicious intent and are creating free apps to steal your info or whatever, but those are fairly rare.
The people who create mods (unofficial add-ons for games) almost always do it for free, and usually because they enjoy it. The other motivation can be because they feel that something essential is missing from the base game, and want to create it for their own use, and then choose to publicly release it.
I would imagine the same motivations are there for those who create free apps and games, although I’m not as familiar with that community.
It’s also sometimes as simple as “I needed/wanted something that didn’t exist, for my own use.” If I “have” to write the app anyway, it doesn’t cost me anything to make it available to others.
Games are a common example of this: “I wanted to play X game, and nobody had written it…” For networked games, it’s also often desirable to have a large population of other players, which is made easier if it doesn’t cost them anything.
I have written a couple macro packages for TeX because I needed them for my own use and it costs me nothing to make them available to all users. But there are developers of some elaborate packages that get nothing from all their work, although a couple have written books and undoubtedly get some royalties (think LaTeX). But it is basically a sharing culture.
They might also be planning on some monetization later (DLC, in-app purchases, a premium version with more features, whatever), but want to build up some popularity before they put it in. Or they just haven’t gotten around to it yet.
In general, it’s a hard industry to make money. The revenue is very unevenly distributed, with few titles making millions (or even billions) and the vast majority making virtually nothing.
If you’re someone who grew up dreaming of making games, that will actually get played, not just sit on a virtual shelf, what ya gonna do?
Also in a broader sense: Just generally you build awareness that “Acme Games” can make fun titles, building brand awareness for a future paid release. And at an individual level, nothing better for your resume than an actual released game of professional quality.