You cannot say the exact reason why they are doing tapasya. But while doing so, they are praying one another in a cycle.
I have read one short story about this in "Shiv Puran". It says,
Once, Mata Parvati got curious about the same thought that why is Lord Shiva always doing tap? To whom is he praying?
So he asked Lord Shiva the same. In reply to that Lord Shiva replied to her that he is praying to the almighty god Lord Vishnu.
And the same question was asked by the wives of the other Lords and after that, this fact was revealed that all the Trinity god are in deep meditation, praying to one another.
And they are not only praying to each other but also seeing the world in their meditation. As when anyone prays for them, they see them in their meditation and then pay them a visit to fulfil whatever they want.
So these two might be the combined reason for why are they always doing tapasya.