When you buy apples in the store they are usually washed prior to being delivered to the store to remove chemicals and dirt etc from the apples.
But it's recommend to at least rinse the apples off before you eat them.
However I don't always wash apples before I eat them whether I buy them in the store or get the apples off an apple tree when I'm near one.
The dirt is not harmful to your health if there is dirt on the apple but if you want to you can wash the apple in some water before eating them.
I don't really bother with washing apples too much or other fruits for that matter.
But I believe any place serving food is required to wash apples and other fruits before cooking with them or before serving them.