First of all, check if the power connector (those 6 or 8-pin cables) is plugged in correctly into the card. Like, push it in until you hear the "click", because sometimes it sits loose and Windows doesn't even see the GPU exists. I had a case at home where the card was technically installed but the power cables weren't seated properly, and the PC just ignored it like it wasn't there. When I plugged the cables in right, boom, it recognized it right away.
Another important thing: if your PSU doesn't have enough power (that RX 7800 XT draws a lot of energy), Windows might detect the card but incompletely or glitchy. If you're not sure about your PSU's wattage, check the label on it. The recommendation is around 700W or more for that card. Also try cleaning the gold contacts on the card with a dry, soft cloth, and dust out the PCI-E slot. Sometimes crud builds up that prevents contact.
One last thing: completely remove all old drivers (Device Manager > Display adapters > right-click > Uninstall device, check the "delete driver software" option) and restart with nothing installed. Then download the latest drivers straight from AMD's website. If it still doesn't recognize it, the card might be damaged (it's used, so it's possible), but test all this first.