How do I remove folder and contents I have created while installing plugin

In WP you have 2 solutions for code to be excecuted during your plugin uninstall process.

First solution

In your plugin’s root folder, create the file uninstall.php. This file will be loaded automatically by WP during uninstall process. Still, to prevent direct access, you need to make sure we’re in the uninstall process for example by checking the WP_UNINSTALL_PLUGIN global.

// If uninstall.php is not called by WordPress, die
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
    die;
}

delete_folders();

// ...

Second solution

In your main plugin file, use register_uninstall_hook.

register_uninstall_hook( __FILE__, 'plugin_uninstall' );

function plugin_uninstall() {
    delete_folders();

    // ...
}