Is this display problem of my MacBook Air a GPU issue? I have a 2019  MacBook Air and sometimes, this problem happens when I try to open the laptop; it glitches. I think this happens because I restored the Mac and deleted all my old files last week.
But this really only happened a few times in the past week and  only happend twice. I don’t know if I have to fix it or if it’s covered under warranty.
Artifacts on the screen like that are typically graphics chip issues (logic board).   However, there is the possibility that it could be related to the OS.  There are a few diagnostic things you can try:

Boot in Safe Mode
Install macOS onto a USB drive and boot from that (32GB or 64GB flash disk is fine.  Make sure it’s USB 3 or it will be slow
Erase the drive and do a clean install of macOS

This is roughly the order you should try things out to see if you can fix or narrow down the cause of the problem.  You can always take it in for service and I encourage you to do so especially if under warranty.