The bike computer doesn’t “see” the things influencing the trainer (eg: if you climb a hill in Zwift, the bike computer doesn’t know that - it’ll show a higher speed than Zwift will in game…“because hill”).
I don’t have a Zwift Hub. I do have a Tacx smart trainer which I pair with both Zwift (via Bluetooth) and my Edge 840 (via ANT+), with the latter only as a speed/cadence sensor and power meter to avoid it fighting for control with Zwift.
Next, go into the Speed/Cadence sensor details on the Edge computer, change “Wheel Size” from “Automatic” to manual. I can tell you I’ve set wheel size to 2825mm after some experimentation and it’s fairly close to approximating speed in Zwift but will differ on hills, or with RoboPacers.
You’re never going to get the two to match perfectly. Some people prefer to log only in Zwift and have it sync to Garmin Connect. I dislike the metrics being lost (training load, L/R balance etc) so I double-log in both Zwift and Garmin Connect. Then, I edit my Garmin Connect ride after the fact so the distance, time, and elevation gain match the Zwift ride. (attach a screen shot of the ride report)