We report the p+p and p+d differential cross sections measured in the SeaQuest experiment for J/ψ and ψ(2S) production at ▪ beam energy covering the forward x-Feynman (xF) range of 0.5<xF<0.9. The measured cross sections are in good agreement with theoretical calculations based on the nonrelativistic QCD (NRQCD) using the long-distance matrix elements deduced from a recent global analysis of proton- and pion-induced charmonium production data. The σψ(2S)/σJ/ψ cross section ratios are found to increase as xF increases, indicating that the qq¯ annihilation process has larger contributions in the ψ(2S) production than the J/ψ production. The σpd/2σpp cross section ratios are observed to be significantly different for the Drell-Yan process and J/ψ production, reflecting their different production mechanisms. We find that the σpd/2σpp ratios for J/ψ production at the forward xF region are sensitive to the d¯/u¯ flavor asymmetry of the proton sea, analogous to the Drell-Yan process. The transverse momentum (pT) distributions for J/ψ and ψ(2S) production are also presented and compared with data collected at higher center-of-mass energies.