Assuming you have your printer connected to a WiFi network?
What computer and operating system do you have?
My guess is that it may be power settings on your computer that is causing the issue. There are other articles that came up in a search, but this WiFi Keeps Disconnecting article, contains several different things to check. It's quite technical, but provides instructions for Windows 10.
Not sure. From what you wrote, it sounded like since things are working great with your phone, I had thought the computer would be the issue.
I'd still look though at your computer's power savings. And double-check any network or power saving settings on printer settings as well. Look for options such as "wake on network access" or similar-worded features and ensure they are enabled.
2/07/2023: New product announcements!EOS R8 EOS R50RF-S55-210mm F5-7.1 IS STMRF24-50mm F4.5-6.3 IS STMRF15-30mm F4.5-6.3 IS STM