Flight QZ535, bound for the Indonesian island of Bali, changed course about 25 minutes after take-off on Sunday.
The Airbus A320, carrying 151 people, landed safely at Perth Airport.
AirAsia said the flight experienced a "technical issue". Australian media said it had appeared to lose altitude.
"We were all pretty much saying goodbye to each other. It was really upsetting," one passenger told the local Nine network.
A video taken on the plane, broadcast by local media, shows oxygen masks hanging from the ceiling and one person shouting "passengers get down, passengers get down".
Another passenger, Claire Askew, told the Seven network that "panic was escalated" by airline staff who were screaming and appeared to be in tears.
In a statement, AirAsia said it was "fully committed" to the safety of passengers. It did not elaborate on the problem.