There are many issues that can cause an issue like this, especially with a wireless connection. Wireless is more convenient, but it is also the most susceptible to interference within the physical environment where you live. Other issues can be the backbone of the internet between your area and where the servers are.
For Wi-Fi, some various issues that can cause problems would be distance to router, amount of devices connected to the router or any other nearby wi-fi access points, other wireless devices period, devices that can interfere with wi-fi signals like phones, microwaves, TVs, etc. being too close to the router or between the router and the device, walls, doors, or other objects between the device and router, etc. There can be issues with wired connections, but not as often. Those can also be resolved just be replacing the cable, unlike with wireless signals.