Latent class models have been widely used in longitudinal studies to uncover unobserved heterogeneity in a population and find the characteristics of the latent classes simultaneously using the class allocation probabilities dependent on predictors. However, previous latent class models for longitudinal data suffer from uncertainty in the choice of the number of latent classes. In this study, we propose a Bayesian nonparametric latent class model for longitudinal data, which allows the number of latent classes to be inferred from the data. The proposed model is an infinite mixture model with predictor-dependent class allocation probabilities; an individual longitudinal trajectory is described by the class-specific linear mixed effects model. The model parameters are estimated using Markov chain Monte Carlo methods. The proposed model is validated using a simulated example and a real-data example for characterizing latent classes of estradiol trajectories over the menopausal transition using data from the Study of Women's Health Across the Nation.