When you open the Pokedex in Bank, it syncs the Pokemon you've seen and caught in the game you're using with Bank's Pokedex. When you transfer a Pokemon from Bank to Home, it also syncs your Bank Pokedex with Home's Pokedex. Home doesn't sync with LGPE or SWSH's Pokedex though, you have to deposit Pokemon from those games in Home to register their Pokedex entries, and Pokemon you've seen but not caught won't be registered.
Source
Going back to my first question on the Database. For Megas, when you transfer any Pokemon from Bank, it will scan Pokemon Bank's entire Pokedex, which in itself is a compiled Pokedex of every game you've interacted Bank with. So if you have Mega Pokemon in your XY, ORAS, SM, or USUM Pokedex, and you've transferred any Pokemon from Bank to Home, those forms and sprites will be in your Home Pokedex.
For Gigantamax forms, if you transfer a Pokemon into Home that has the Gigantamax logo, it will add the entry for your Gigantamax Pokemon into the Home Pokedex.
Hope I could help! Please ask if you have more questions