Some jurisdictions have no legal limitations on running for office. Consider Dorset, Minnesota which had a four year old Mayor.
Saira Blair, an eighteen year old Republican West Virginia state legislator (who was just seventeen when she won the primary election to put her on a November ballot at which time she was eighteen) certainly is an example that there can indeed be an eighteen year elected official who actually campaigns on her own and legitimately serves. As the other answer noted, few countries allow people who aren't old enough to vote to run for office, and few countries allow someone under the age of eighteen to vote.
Similarly, "William Lloyd, an 18-year-old high school student from Brentwood in Essex, won the British local council elections for the conservative party in May 2007[.]" (The Chinese People's Daily newspaper linked for this point, incorrectly asserts that this made him an MP, when in fact, he was merely a local government council member.) Terence Smith, of the Labour party, who was Mayor of the small town of Goole, is reputedly the youngest Mayor who has ever served in Britain.
Seventeen year old Emily Provencio was elected to an officer position in the Democratic Party in Washington State.
A number of countries allow sixteen or seventeen year olds to vote in at least some elections and would be most likely to have elected officials who were under eighteen. The voting age is 16 in Brazil, Austria, Nicaragua, Argentina, some states in Germany and a canton in Switzerland. It is 17 in Indonesia and South Sudan. Sixteen year olds were allowed to vote in the Scottish referendum on independence in 2014, but they can't vote in candidate elections in Scotland. Norway experimented with a lowered voting age in 2011. "Studies from a municipal election in the United States, as well as national elections in Denmark and Austria, have shown that 16- and 17-year-olds are avid political participants and that voting at 16 and 17 is habit-forming."
Worldwide there were 126 members of national parliaments, worldwide, who were under age 30. According to the same source there are a very small number of women, but no men, under age of twenty-one, who hold such offices.