A personal loan can technically be used for investing, but it’s not a good idea. Personal loan companies often ask for the reason you’re taking out the loan (such as home renovations or debt consolidation), but once the money is in your account, you can use it for pretty much anything. However, it’s a bad idea to invest with borrowed money, as the interest expense can hurt your returns, and if your investments end up losing money, you can find yourself owing more than your investments are worth.
The short version is that a personal loan can be used for investing, but it’s not a great financial move. Brokers offer margin accounts for this exact purpose, and these are at least backed by securities in your account.