So, after some time of research it seems it depends on the kind of Entra license.
In our not so big company with a minimal Entra license I only get GroupIds and can call Graph to get the names.
At our customer, having an Entra license with more features, we can go to App registrations, open our App, goto Token configuration, open the groups claim and select sAMAccountName.
He then gets the group names instead of the group ids.
When I select this setting nothing changes, I still get the group ids.