How do you infer gender from a first name?
By looking the name up in records of people whose gender is known, and returning the share that is male or female — ideally for the country the person lives in, because the same name can go either way in different countries. The alternatives are a fixed name list, a model trained on spellings, or asking a language model. They differ most in what they return for a name they do not know.