To obtain a legal name change in Maine, an applicant must submit a petition to the probate court. There is a publication requirement which can be waived if the applicant is a victim of abuse or is currently in reasonable fear for their safety. (Me. Rev. Stat. tit. 18-A, § 1-701)
For instructions on legal name changes for minors under 18 in Maine, see NCTE's Name Changes for Minors in Maine resource.