In Cradle of Empires, you can upgrade a building only when you have both the required XP level and all the stars it needs.
Each building upgrade has requirements (tap on the arrow button to view).
If you can not upgrade building right now, there are two possible reasons:
1 - You need to reach the required XP level. Once you reach it, the XP shield will be marked with a green tick as in the image below.
2 - You need to collect 24 stars while playing levels. Once you collect all required stars, the counter will be marked with a green tick as in the image below.
When you complete both goals, the upgrade window will appear after tapping on the arrow button.