A search for the standard model Higgs boson decaying to a charm quark-antiquark pair, H $\to$$\mathrm{c\bar{c}}$, produced in association with a leptonically decaying V (W or Z) boson is presented. The search is performed with proton-proton collisions at $\sqrt{s}$ = 13 TeV collected by the CMS experiment, corresponding to an integrated luminosity of 138 fb$^{-1}$. Novel charm jet identification and analysis methods using machine learning techniques are employed. The analysis is validated by searching for Z $\to$$\mathrm{c\bar{c}}$ in VZ events, leading to its first observation at a hadron collider with a significance of 5.7 standard deviations. The observed (expected) upper limit on $\sigma$(VH)$ \mathcal{B}$(H $\to$$\mathrm{c\bar{c}}$) is 0.94 (0.50 $^{+0.22}_{-0.15}$) pb at 95% confidence level (CL), corresponding to 14 (7.6 $^{+3.4}_{-2.3}$) times the standard model prediction. For the Higgs-charm Yukawa coupling modifier, $\kappa_\mathrm{c}$, the observed (expected) 95% CL interval is 1.1 $\lt$ $\vert\kappa_\mathrm{C}\vert$ $\lt$ 5.5 ($\vert\kappa_\mathrm{c}\vert$ $\lt$ 3.4), the most stringent constraint to date.
Signal strength modifier $\mu_{VZ(Z\to c \bar{c})}$, where V = W or Z.
Signal strength modifiers $\mu_{VH(H\to c \bar{c})}$, where V = W or Z.
Upper limits at 95% CL on the signal strength modifier $\mu_{VH(H\to c \bar{c})}$, per analysis channel and combined.