How to append classname to body tag if guest user

Yes, there’s the body_class filter. You could use e.g.

function body_class_guest_user( $classes, $class ) {
    if ( ! is_user_logged_in() ) {
        $classes[] = 'guest-user';
    }
    return $classes;
}
add_filter( 'body_class', 'body_class_guest_user', 10, 2 );

However you could equally well just use the :not() selector, e.g. body:not(.logged-in) (browser support),
or absence of logged-in i.e. set up the guest-user styling as default but then override it if .logged-in.

error code: 523