Air conditioners(AC's) are a type of refrigerators.
As we all know that when a liquid turns into a gas i.e phase change, it absorbs heat to do so. This is the underlying principle of AC's.
AC's use special liquids called refrigerants which alternatively are converted into liquid and gas.
While converting from liquid to gas, they remove the heat from the room. This heat is released to atmosphere when gas is converted to liquid again.
Thanks for reading. Do upvote.