How can I provide a checkbox to display name as 'anonymous'?
You can add one more text field to user entity, keep it hidden.While registering the user check if show as anonymous user field is checked save the hidden field value as anonymous else copy the user name field to hidden field.

You can do the above changes in hook_user_presave().

Finally add this hidden field to your user view, instead of name field.