Greetings,
Welcome to the forum.
I am not a HP employee.
Random, intermittent, problems are tough to troubleshoot. Plus your PC is fairly new.
When did this symptom first occur?
What type of storage does your PC have? Are you streaming games or are you running games from local storage? Slow platter HDDs can cause a lag. Or you may latency issues with your network connection.
Run a check disk (Link) to verify system files.
Run HP hardware diagnostics at boot (Link). Tap "ESC", then select "F2". Run System tests. You can also run component tests.
Finally, you could stress test the CPU and GPU for thermal issues. Run each test for at least 20 minutes,
CPU:
Download and run Prime95 (Link). Download and run HWInfo portable (Link) while Prime 95 is running to check stability.
GPU:
Download and install Furmark (Link). Run Furmark with GPU temperature monitoring on, full screen, set to your monitor's native resolution.
I would also test RAM. Windows has a Memory Diagnostic Tool in Control Panel, Administrative Tools. You can set this diagnostic to run at the next boot to test memory.
Regards