There are a couple of parts to your question. Each cockerel is an individual and different ones can mature to the point of producing viable sperm at different ages. Four months is a good average but individuals can be early or late.
The other part, which both Sam and Aart alluded to, is that he has to be able to deliver the sperm to a pullet or hen that is laying eggs. Cockerels tend to mature earlier than pullets and can be forceful about mating them. That can be hard to watch for a lot of people because he chases them down, grabs them by the head, and forces them. Not all cockerels and pullets do that but it is really common. This has nothing to do with him delivering sperm because those pullets are not forming eggs. There is nothing to fertilize. This is him establishing dominance over the pullets. If you can get through this phase they tend to mellow out when the cockerel and the pullets both mature but some never do. Many cockerels literally lose their heads and become dinner in this phase.
Why are you asking? I feel like we are not responding to your real concern.