We point out that the accidental U(1)B−L symmetry can arise from a finite modular symmetry ΓN in the type-I seesaw. The finite modular symmetry is spontaneously broken in such a way that the residual $$ {\mathbb{Z}}_N^T $$
ℤ
N
T
discrete symmetry, associated with the T-transformation which shifts the modulus τ → τ + 1, remains unbroken. This discrete $$ {\mathbb{Z}}_N^T $$
ℤ
N
T
symmetry mimics U(1)B−L, and hence the majoron appears as a pseudo Nambu-Goldstone boson of U(1)B−L. Without introducing additional interactions, the modulus τ can be stabilized by the Coleman-Weinberg (CW) potential given by the Majorana mass terms of the right-handed neutrinos. We study cosmological implications of the majoron, with particular interests in the dark matter and dark radiation, where the latter may alleviate the Hubble tension. We also find that the CW potential can have a wide range of nearly exponential shape which prevents τ from overshooting, and makes the amount of dark radiation not too large.