How do sites recognise a device?
The User-Agent and Client Hints say which browser and system you use. The graphics card, screen, processor cores and memory come from browser APIs, and the TLS and TCP handshakes come from the connection itself.
The browser can claim anything in its User-Agent, but the handshakes and the hardware are much harder to fake. That is why a claim that does not fit the measurements is a strong sign of spoofing.