See microsoft/TypeScript#40049 for an authoritative answer to this question, although it doesn't in my opinion shed much light on the underlying reason.
Specifically this comment:
@jack-williams commented on Aug 14, 2020:
This isn't especially well-documented outside of the source-code, but in the checker you'll find in the relevant place:
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & TypeFlags.Any) {
So any
is treated like a wildcard that matches both branches.
Currently you can find the code on line 15239 (GitHub won't let you link to specific lines in files as big as this one), and it was introduced in this commit inside microsoft/TypeScript#21316, the pull request that implemented conditional types in the first place. So it's been this way as long as conditional types have existed.
That's the closest you'll get to "why" this happens. The official answer is "since it matches anything".