Building a school on land endowed for a mosque
Land endowed for a mosque is subordinate to the mosque, so it is not permissible to convert it into a school, because doing so changes the endowment from the purpose of the one who endowed it. However, while keeping the endowed status of that place for the mosque, it is possible to teach children there or in the mosque.
Reference: Al-Lajna al-Da’ima: 18050