Hi sir....
If u have habits like smoking,pan chewing kindly quit the habit ...painful mouth opening may be due to oral soft tissue problem like oral submucous fibrosis, muscle damage, or you may have TMJ problem like arthritis, or due to trauma ,or if you have any recent wisdom tooth extraction....which can be rule out only by oral diagnosis
Next Steps
Immediately visit your nearby dentist for furthur oral diagosis and do treatment as prescribed