When trying to change the account or accounts associated with an iPhone, iPad, or Mac that has Screen Time enabled with a passcode—ostensibly for a child—you will find that the Sign Out option is grayed out. That’s true in System Preferences in macOS and individual apps, and in Settings > account name > Sign Out and Settings > Media & Purchases in iOS and iPadOS.
The simple solution can be a little difficult to find, because there’s no prompt or information about why it’s grayed out. It’s unavailable to prevent a device locked down by Screen Time restrictions from evading them by signing out of the associated Apple ID.