For the US, there's an article on Constitution Daily which says something about this. First it says:
At the Constitutional Convention in Philadelphia, there was little
public debate about the age requirements and no discussion about the
age requirement for the presidency.
Then it gets more helpful when it refers to James Monroe.
James Monroe also wrote about the presidential age requirement making
it difficult for a father and son to serve in a dynastic way. “The
Constitution has provided, that no person shall be eligible to the
office, who is not thirty five years old; and in the course of nature
very few fathers leave a son who has arrived to that age,” he said in
“A Native of Virginia, Observations upon the Proposed Plan of Federal
Also, some clues can be found in what two founders said when discussing the senate and house.
The one discussion of note involved two important Founders: James
Wilson, a future Supreme Court Justice, and George Mason, a
constitutional dissenter. Mason, who was 62 years of age, argued that
a requirement of 25 years of age was needed for the House because of
his own experience. Mason said, “if interrogated [he would] be obliged
to declare that his political opinions at the age of 21 were too crude
and erroneous to merit an influence on public measures.”
And there is also this.
Madison talked about the need for “senatorial trust” which required
“greater extent of information and stability of character … that the
senator should have reached a period of life most likely to supply
Madison also discussed some points that some scholars believe led to
the age requirements: a distrust of foreign influence and a fear of
families trying to put children in place in federal office to serve in
a hereditary manner. He feared the “indiscriminate and hasty
admission” of people to Congress that “might create a channel for
foreign influence on the national councils.”
Going by this train of thought, the president should be even older but I admit it doesn't really explain why 35 and not 30.
Generally, maturity and experience are probably very important but some countries have very different age requirements, like only 18 in Croatia, France and Finland but 50 in Italy. (this is from Thirty-fifth Amendment of the Constitution (Age of Eligibility for Election to the Office of President) Bill 2015: Second Stage)