How to get the district/city/municipality given a gps position as well as the corresponding polygon

Do you know the overpass api?

Have you used that api to find a relation that your coordinate is inside?

Have you checked that relation for the admin_level or border tag to find your city, district or municipality?