A kyai (kyaa-ee) is a (Javanese) expert in Islam.
The word is of Javanese origin. Sometimes it is spelled kiai. Traditionally, students of Islam in Indonesia would study in a boarding school known as a pesantren. The leader of the school was called kyai, as a form of respect. The traditional word for a teacher in Islam is ustad, which is a Persian word. There are many ustads in Indonesia who teach the religion, but most of them do not have a boarding school.
Kiai were educated in various pesantren:
Highly motivated students went from pesantren to pesantren, studying in each the texts in which its kiai was specialised. After a few pesantrens in Banten, they would go on to pesantrens in Bogor, Cianjur, Cirebon, Central or East Java and finally, if their families could afford it, to Mecca, the most prestigious centre of Islamic learning.
A student in a pesantren is called a santri. After the founding kyai of a pesantren dies, his son or another santri may take over the supervision of the school, and would then be called kyai. It is possible for a large boarding school to have several kyai living and teaching there. However, most pesantren have a few hundred studentsr, with only one person who is called kyai. The other teachers in the school are called ustadz. Many Indonesian Muslims consider a kyai to be higher ranked than an ustadz because a kyai runs his own boarding school and has mystical abilities.
Kiai were distinct from the pangulu, the state officials:
The pesantrens were typically (although not uniquely) located in rural districts, away from the major roads. Their geographical isolation symbolised, as it were, their ideological distance from the state. The pangulu, as a state official, and the independent teacher, the kiai, were two contrasting types, in Banten as well as elsewhere in Java."
A kyai is not a cleric in the same way as a priest in Christianity or Buddhism. There is no governing body that ordains or authorizes a kyai. Likewise, no organization can defrock a kyai or remove him from his position. The reason is that a kyai has his position and authority because people will listen to what he says.