Is the government exempt from anti discrimination legislation
Broadly speaking, the government (in Canada, the executive power vested in Her Majesty the Queen) is not subject to any law unless the legislature binds the Crown explicitly.
In this case, Ontario Human Rights Code does bind the government and any agency of the Crown. However, Canada is a federal country, and for certain areas exclusively regulated by the federal government, provincial laws may not apply fully. This is the case for human rights and employment laws; the federal government along with federally regulated industries (banking, telecommunications, airlines etc.) enjoy immunity from provincial human rights codes. But they are still subject to the federal Canada Human Rights Act (which only apply to businesses under the federal jurisdiction), which also prohibit age discrimination.
Additionally, government actions are also subject to the Canadian Charter of Rights and Freedoms, section 15 of which prohibits discrimination based on age.
what is with the huge number of jobs that list "Must be eligible to participate in the Canada Summer Jobs (CSJ) program" as a requirement (with <30 being the top listed requirement).
For example, the Canada Summer Jobs (CSJ) program you referred to in the question is a federal program within the spending power of the Parliament of Canada and are immune from provincial laws that interfere with its application. Ontario laws simply to no apply in this case (but federal law and the Charter does) even if an action physically happens in Ontario.
What Exemptions are there to the Age Discrimination laws in Ontario?
Anti-discrimination law in general only prohibits "unreasonable" discriminations. If someone can show that they have "good reason" to discriminate, it can be legal. For example, it is legal for a casting director to choose a black man to portray Martin Luther King Jr. instead of a white woman. It is also legal to discriminate against people with certain disabilities if they are in fact unable to carry out tasks required in a job even with reasonable accommodation. It is also legal for an employer (or for the law to require an employer) to give special leaves to women for pregnancy and childbirth, even though otherwise discrimination is not permitted based on sex.
Age-based discounts for example are usually not illegal (and even explicitly legal in Ontario's legislation for senior's discounts) if the purpose is genuine (e.g. less spending power for teens and seniors).
While age requirements are on its face a discrimination, youth programs usually qualify as affirmative action programs that are designed to ameliorate the conditions of a disadvantaged group. It is the same basis why certain gender-, race- or age-based scholarships and grants are legal. In the employment context, the government considers youths as a disadvantaged group and improving youth employment is a reasonable government objective.
The Charter allows affirmative programs by the government:
(2) Subsection (1) does not preclude any law, program or activity that has as its object the amelioration of conditions of disadvantaged individuals or groups including those that are disadvantaged because of race, national or ethnic origin, colour, religion, sex, age or mental or physical disability.
and both federal and Ontario human rights legislations allow special programs:
14 (1) A right under Part I is not infringed by the implementation of a special program designed to relieve hardship or economic disadvantage or to assist disadvantaged persons or groups to achieve or attempt to achieve equal opportunity or that is likely to contribute to the elimination of the infringement of rights under Part I. R.S.O. 1990, c. H.19, s. 14 (1).
16 (1) It is not a discriminatory practice for a person to adopt or carry out a special program, plan or arrangement designed to prevent disadvantages that are likely to be suffered by, or to eliminate or reduce disadvantages that are suffered by, any group of individuals when those disadvantages would be based on or related to the prohibited grounds of discrimination, by improving opportunities respecting goods, services, facilities, accommodation or employment in relation to that group.
Canadian Human Rights Act