Studies of CP violation and anomalous couplings of the Higgs boson to vector bosons and fermions are presented. The data were acquired by the CMS experiment at the LHC and correspond to an integrated luminosity of 137 fb-1 at a proton-proton collision energy of 13 TeV. The kinematic effects in the Higgs boson's four-lepton decay H→4ℓ and its production in association with two jets, a vector boson, or top quarks are analyzed, using a full detector simulation and matrix element techniques to identify the production mechanisms and to increase sensitivity to the tensor structure of the Higgs boson interactions. A simultaneous measurement is performed of up to five Higgs boson couplings to electroweak vector bosons (HVV), two couplings to gluons (Hgg), and two couplings to top quarks (Htt). The CP measurement in the Htt interaction is combined with the recent measurement in the H→γγ channel. The results are presented in the framework of anomalous couplings and are also interpreted in the framework of effective field theory, including the first study of CP properties of the Htt and effective Hgg couplings from a simultaneous analysis of the gluon fusion and top-associated processes. The results are consistent with the standard model of particle physics.