My 5 month old child keeps playing with his ear I cleaned them out but he still doing it could you give an idea what it is?

Playing with body! If his ears have been checked out and there is no evidence of infection or fluid, it may not be any illness or problem at all. He may have discovered he has ears! my guess is when you take his diaper off, he's playing with other body parts as well. At this age they are developing fine motor controls and can touch and feel things sticking out from their bodies to ge to know themselves.
A couple of things. A 5mo may be feeling a bit of pressure in his ear like you do coming in to land at the airport, or fluid trapped behind the eardrum. He could have discomfort transferred to his ear during teething or from a low grade ear infection. If it persists, an exam can help sort out the possibilities. If baby is playful & happy most of the day, i would do it when convenient, not urgently.
Habit. It could be normal. If no associated symptoms like fever, irritability, or URI symptoms then probably normal.