Training specifically to increase lung function is something that’s been well researched in regards to helping older or infirm people to improve overall quality of life, as well as trying to improve athletic performance.
But we need to remember that it’s the diaphragm and chest that are the target of training, not the lungs themselves. There’s not much you can do about the growth of lung size but, like any muscles, those that control and power the mechanical aspects of breathing are extremely trainable.
Most of the time athletes’ respiratory muscles are trained as part of general conditioning, for example when swimming, cycling and running you breathe harder and as a result the respiratory muscles get a workout, just like your arms and legs do. Certain types of training such as high-intensity intervals and VO2 max workouts will increase the training effect on respiratory muscles as they push them much harder than a gentle aerobic session.
But while specifically training lung power and function is likely to increase your abilities, whether it will actually improve overall performance is less clear. There’s evidence that it might well do in some but not all cases.