As per one of my previous posts HERE on how to edit active directory attributes , When dirsync is enabled it wont populate the GAL with exchange online and exchange on-premise.
Lets say my email address is email@example.com.
You need to populate some ad attributes.
Proxy Address: SMTP:firstname.lastname@example.org & smtp:email@example.com
Target Address: SMTP:firstname.lastname@example.org
So after those attributes have been synced via dirsync run this powershell command in the exchange management shell
Enable-RemoteMailbox email@example.com -RemoteRoutingAddress firstname.lastname@example.org
So once this is done all you need to do is apply a license and usage location to email@example.com
And then the GAL will be populated between Exchange On premise and Exchange online.