The causes of tinnitus
(ringing in the ears) could fill a small encyclopedia, including hearing loss
from excessive noise.
Here is a good link to reliable information about tinnitus. I suggest you read up on it and see if you can identify which of the causes discussed might match what is happening to you when you get it. You might also consider seeing an ear nose and throat specialist.