This paper investigates data-driven controller learning for discrete-time nonlinear systems with unknown dynamics. The system parameters and disturbances are drawn from unknown distributions, and the objective is to minimize the expected finite-horizon quadratic cost using observed trajectories. We establish a high-probability PAC--Bayes performance bound for a finite class of possibly time-varying nonlinear controllers. Under explicit polynomial-growth and moment conditions, the bound accommodates potentially unbounded quadratic costs and provides a theoretical guarantee on the expected control cost under unknown system uncertainties. Based on this bound, we develop a trajectory-based learning algorithm that evaluates candidate controllers using empirical quadratic costs and learns a posterior distribution over the controller class by minimizing the PAC--Bayes upper bound. The proposed framework does not require explicit identification of the unknown system dynamics and can accommodate nonlinear controllers, including neural networks. Numerical experiments on an omnidirectional mobile robot demonstrate near-optimal performance without knowing the true system parameters, improved performance over a least-squares-based approach under parameter uncertainty, and applicability to neural-network controllers.