Put it in your theme’s functions.php and update the form id (999999) to your CF7’s form ID.
Integrating your website with MailChimp is easily done with this code. You can connect it with any form that’s processed with PHP.