Can be any number of things. Too far from Wifi point. Low signal quality (how many bars do you get on the icon in the tray). Malware messing up the computers internet. Your illegally on someone else's wifi and they keep trying to kick you off by resetting it. etc.
How about plugging right into your router with a wired connection, does it work then? If so, then standing 5 feet from it, does it work wirelessly? If NO in both, then while wired download Malwarebytes and run a scan to make sure nothing is wrong. If wired doesn't work sounds like Windows (assuming this is even a Windows machine? and not even knowing the version it is) is or the hardware is fragged up and your computer needs to be serviced by a professional.
Considering the...