I know how you load a crossbow IRL but in the game you need a free hand to load them, and crossbows are two handed weapons (except the hand crossbow, but even that is sort of a two handed weapon because you need a free hand to load it so you sort of need to treat it like one).
So if you’re using two hands to hold it, then how do you load it?
You don't actually need a free hand to load a light or heavy crossbow.
You only need a free hand to load a one-handed weapon, not a two-handed weapon. This is clarified in newer printings of the Player's Handbook.
Both light and heavy crossbows have the Ammunition, Loading and Two-Handed properties:
You need a free hand to load a hand crossbow, as that's a one-handed weapon.