My iCloud was greyed out, the steps below are what helped me fix it.
Here are the steps you need to perform
Tap Settings > Screen Time > Content & Privacy > scroll to Allow Changes, and check to see if Account changes are allowed. If not, enable them and check to see if your Apple ID is no longer grey.
iPhone 13 Pro, iOS 16