If you are the owner of the life insurance policy, and pay the premiums, you choose who is the beneficiary of the life insurance policy.
However, in order to buy life insurance on another person there must exist Insurable Interest between you and the person you want to insure for life insurance.
Insurable Interest means you rely on that person for financial support, or you stand to lose financially if that person were to die.
Insurable interest does exist between spouses, siblings, parents and their children, relatives, and business partners, among others.
In addition to needing an insurable interest in the person you want to insure, you will need that person's permission/consent, signature on the application for life insurance, and the person may need to answer some health questions, and maybe take a paramed exam when you apply for the life insurance policy.
If the person is under age 18 and you are the parent, the insurance company may allow you to buy life insurance on the person without the child's consent.
Here is a guide to buy term life insurance online which provides information and tips for planning to purchase a life insurance policy.