Your options for how you invest the money in your 401(k) plan are limited by how your company's plan is set up. Typically, you're offered several investment options, one of which may be a brokerage account. If your company doesn't offer a brokerage account option, you're not able to pick individual stocks for your 401(k) plan. Even if your company's 401(k) plan does offer a brokerage account, it may limit your options to mutual funds and not individual stocks.
Brokerage Account Function
After you allocate money to a brokerage account that permits investing in individual stocks, you can then use that money to purchase the stocks you want to hold in your portfolio. The mechanics of how to carry out the purchase transaction will vary from plan to plan. Check with your plan administrator or any relevant materials it has provided. However, you're always prohibited from trading on margin because of IRS rules. Your plan may impose other restrictions on riskier trading.