Get current user id in function php

You’re running your code on the wp_loguout hook, which is after the user has logged out, so of course there’s no current user ID. There’s no current user at all.

If you look at the documentation for the wp_logout hook, you will see that the ID of the user that was logged out is passed to any hooked functions. You need to use that if you want the logged out user’s ID:

function do_anything( $user_id ) {
    // $user_id is now the logged out user's ID.
}
add_action( 'wp_logout', 'do_anything' );

Also, you really should not be creating a new connection to the database and using SQL if you want to update user meta. You should be using the proper function, update_user_meta():

function do_anything( $user_id ) {
    update_user_meta( $user_id, 'alg_wc_ev_is_activated', '0' );
    // etc.
}
add_action( 'wp_logout', 'do_anything' );