The XBPlay app allows you to remote play from outside of your home network, however, you will need to enable port forwarding to do so.
Port Forwarding:
Access your router's dashboard by opening a web browser (e.g., Google Chrome) and entering your router's IP address in the address bar. This will open your router's dashboard.
Navigate to the port forwarding section in the router dashboard, often located under "WAN", "Firewall", or "Internet" settings.
Add the following port forwarding role:
Port: 9002
Protocol: Both UDP and TCP
Internal and/or External IP address: The address of you Xbox console.
If you can't find your router dashboard or the port forwarding setting, get your routers make and model and google search. It will be documented online somewhere.
Troubleshooting:
If you have followed the above steps but are still unable to connect to your console form outside of your home network, here are some common tips that may help.
Confirm the IP address you entered is correct. They can change over time.
Using ethernet instead of WiFi on the Xbox.
Set up a DMZ for your xbox.
Disable toggle IPv6 on you router and xbox.
Open more ports, specifically port 3074.
Open the Xbox "Settings -> Network" and ensure the default port is selected, rather than a custom port.
Ensure your ISP is using a public IP address, more details on this here: https://www.pcwrt.com/2021/12/do-you-have-a-public-ip-address-from-your-isp/