This is an idiom. It has a special meaning that is different to the ordinary meaning of each separate word.
It means to do silly things to atract people's attention and/or make them laugh.
For example, "Stop playing the fool! Everybody is looking at us". This means that someone is being silly and people are staring at him/her.
Do you know any other idioms using the word 'fool'?