XAMPP is a compilation of free software (comparable to a Linux distribution), it’s free of charge and it’s free to copy under the terms of the GNU General Public Licence. But it is only the compilation of XAMPP that is published under GPL. Please check every single licence of the contained products to get an overview of what is, and what isn’t, allowed. In the case of commercial use please take a look at the product licences (especially MySQL), from the XAMPP point of view commercial use is also free.
Many people know from their own experience that it’s not easy to install an Apache web server and it gets harder if you want to add MariaDB, PHP and Perl.