That's because your device doesn't need to contact the website, and the website isn't checking anything on your device.
The answer is that both your device & the app are doing the same math, at the same time, arriving at the same answer.
Here's how TOTP actually works 🧵
1/
Have you ever wondered:
Google Authenticator generates a working 6-digit code in airplane mode, without internet or a signal.
And the website instantly knows if it's right.
How does the server know what your phone generated?