Borrowing money to make an investment is called leverage. If the interest rate of the borrowed money is less than the return on the investment (considering of course all taxes and fees) then it is a profitable proposition.
Leverage is common in investing, though perhaps not in the specific way you describe. Some examples:
A widget factory might issue a bond to purchase an automated widget machine. They believe the return they will get in investing in the machine is greater than the interest they will pay on the bond.
Many brokerage accounts offer a margin account, which is effectively a loan the brokerage gives you, with your assets at the brokerage as colateral. The brokerage can lend you cash which you can use to buy more shares of a thing you believe will increase in price, or you can have the brokerage lend not cash but securities. You can then sell them to someone else, then buy them back later at a lower price and repay your loan. This is called short selling.
An individual that has a mortgage on their home may choose to invest some excess income in the stock market rather than paying down the mortgage balance. This is effectively deciding to pay more interest on the loan for a chance at making returns to cover that interest and more in an alternative investment.
Leverage multiplies gains, but it also multiplies losses. Additionally, it adds expenses of its own because the creditor will want to be compensated with interest on the loan. That interest diminishes your returns.
As such, leverage also increases risk and volatility. Before deciding to leverage your investments, you should think about the risks. Without leverage, you can't lose more money than you initially invested (the "cost basis"). But with a leveraged investment you can lose more than that. Your investment can lose all its value, and you still have to repay the loan.
Consequently you'll find more leverage in situations where there are limits on liability. For example, startup corporations are often extremely leveraged. They can do this because the liability of the corporation doesn't extend to the personal assets of the shareholders. If the company fails it can declare bankruptcy and the shareholders still have their home. For an individual however the stakes are higher: you could lose all your assets.
If you've duly considered the risks and still want to leverage your investments, I'd suggest looking for other ways to accomplish it besides what you've proposed. Your bank will probably want something for collateral, like your house. Or, they may be able to garnish your wages. You shouldn't risk more than you can afford to lose. Can you afford to lose your house or your income?
Instead, see if your broker can offer a margin account. Check the details, but in most cases the broker's recourse is limited to liquidating the assets in your account. This way you have some bound on the worst case outcome that doesn't leave you homeless.
In general though, I wouldn't recommend leveraging your investments as an individual. Keep in mind that anyone can do what you are proposing, and so if it truly was a "can't possibly lose" strategy, everyone would do it. This would then mean banks would have high demand for loans so they could charge more interest, and companies seeking investors would have many people offering them money, so they could get away with lesser returns. This dynamic creates pressure for the bank's interest rate and the return on investment to converge, making this scheme less profitable.
So if the market is efficient, the risk adjusted return of your loan and your investments should be the same, so by investing in this scheme you are betting that the market consensus has misjudged the risk of investing in the stock market or loaning money to individuals. If you don't have any particular data to support that view, then it is not a prudent investment.