"can capital gains be allocated to a beneficiary in a trust through a K-1"
Yes, provided the gains are distributed pursuant to the terms of the trust instrument and applicable local law, or pursuant to a reasonable and impartial exercise of discretion by the trustee.
See Treas. Reg. §1.643(a)-3(b)