There are many reasons to disconnect from just a little too far from the router, malware, wifi channel of the router and more.

All I have to work with here is "HP Envy" and the symptom. It's very technical and let's go with it never worked right. Make it a warranty issue.