AFWall+ is a firewall for Android that decides which apps can use the network. It is a front end for iptables, the Linux packet filter, aimed at people who have root access and want per-app control.
It can import and export rules to external storage, search installed apps, keep several named profiles, and highlight system apps in a chosen colour. It can notify on new installs, supports VPN use, and offers device admin protection against uninstalling. Root access is required. Source is public under GPL-3.0-only, and a paid version with extra features is advertised in the app.
Alternatives to AFWall+
Products that do a similar job in Security & Privacy.
LuLu
Open-source macOS firewall that blocks unknown outgoing connections
Rethink
DNS client, firewall and connection tracker for Android
Portmaster
Application firewall for controlling outbound network traffic
BlockAds
System-wide ad and tracker blocker for Android without root
Tailscale
Mesh VPN that connects your devices over WireGuard
PCAPdroid
Traffic monitor and app firewall that runs without root
NetShield
On-device DNS resolver, firewall and ad blocker for Android
ProtonVPN
VPN client for macOS focused on security and privacy