This question is difficult to answer because several factors are involved. It is generally said that you should replace your bike chain every 3,000 kilometres. After this distance, your bike chain is worn to the point where it can cause damage to other parts such as your chainrings and cassette. But there is more to it than distance alone. If, for example, you ride rather frequently in rainy conditions where mud and dirt get on your bike chain, it will wear faster and you will have to replace it before having cycled 3,000 kilometres.
It also depends on how well you lubricate your bike chain. If you lubricate it regularly, it will run smoother and wear less quickly. If you’re not sure about when to replace your bike chain, it is a good idea to get a chain checker. With such a chain wear indicator tool, you can easily see when your bike chain needs replacing.