Malls are private areas.
That means that they are essentially the same as a person's home - when the mall owner decides to invite people into the mall, she or he can decide what rules there are about staying. These rules obviously include not breaking local laws, but also usually include things like not fooling around on the escalators and elevators, not bothering other people in the mall and other behavior that might not be 'illegal' according to the law, but are rules that make everyone's visit to the mall safer and better. The mall owner can make reasonable rules and you as a guest, must follow them. To answer your question, mall security has the authority, granted by the mall owner, to see that the mall rules are followed. If you've done nothing wrong, there should be no reason for security guards to contact you.