Your code above loops over the field’s choices and adds them as options.
How have you saved the choices in the field’s settings?
Have you formatted the choices so that code could read it into optgroups?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users