Ibuprofen can cause stomach problems so should always be taken with or just after eating food. If a doctor prescribes the medication, the doctor will prescribe a medication to line and protect the stomach, like Omeprazole.
I would not give your son any more Ibuprofen. It clearly does not suit him. I was prescribed Ibuprofen by my doctor and had to stop taking it because it caused oedema (fluid retention) in my legs. It took months for it to get out of my system and for my legs to get back to normal (well, apart from the arthritic joints).
Rather than giving Ibuprofen for pain, it is better to stick with paracetamol (pain relief medication) and take the dose as prescribed on the packet or as the doctor advises.
Chest pains could be from anxiety and stress as well as other reasons. If your son experiences any more chest pains, take him back to the doctor so that the doctor can listen to his chest. Lung infections and asthma can cause chest pains as too as indigestion as well as heart problems.
It is possible that he is having a reaction to the Ibuprofen. If he has discomfort he should stop taking it and find an alternative. If he has swelling he should take something like fish oil.