Shopping malls were popular with different people because some would go to the shopping mall to shop, eat or hang with friends. I know this because it states in paragraph 3, "Shopping malls attracted different people and provided something for everyone."
In this sentence the infinitive ("to eat") is being used as an adjective, since it is modifying the word "apple--thus giving us more information about the object itself.