A nuclear magnetic resonance (NMR) study is reported for a 5f-cooperative Jahn-Teller (JT) system with antiferromagnetic ordering, UO2, where we have performed magnetic actinide (235U) as well as nonmagnetic ligand (17O) NMR studies in a 5f-electron system. The observed 235U hyperfine interaction is consistent with an axially symmetric 5f-wave-function character for U4+ below a first-order transition temperature TN=30.8 K. Thus, the orbital degeneracy in the cubic crystalline field is lifted by a magnetic ordering combined with a JT distortion. On the other hand, modulation phenomena in the 17O spin-echo decay provide evidence of a lattice distortion just below TN, which gives rise to an axially symmetric electric-field gradient at the oxygen sites. These results indicate that, in a cooperative JT transition which occurs as a result of coupling between 5f quadrupoles and lattice distortion, the behavior of the 5f quadrupoles can be investigated using uranium NMR, while the lattice distortion can be studied with the nonmagnetic ligand NMR. Among magnetic structures and JT distortions, proposed on the basis of neutron scattering experiments and theoretical work, the noncollinear 3k-type structure is the most likely, because either the 1k or 2k would cause an orthorhombic distortion. With respect to low-energy spin-wave excitations, nuclear spin-lattice relaxation rates T-11 at both sites show a T7 behavior below TN, which suggests the presence of gapless excitations due to strong magnon-phonon coupling.