Why does std::any_cast throw a std::bad_any_cast exception when an implicit conversion from the actual stored type to the requested type would be p
To do what you want you'd need full code reflection and reification. That means every detail of every type would have to be saved to every binary (and every signature of every function on every type! And every template anywhere!), and when you ask to convert from an any to a type X you'd pass the data about X into the any, which would contain enough information about the type it contained to basically attempt to compile a conversion to X and fail or not.
There are languages that can do this; every binary ships with IR bytecode (or raw source) and an interpreter/compiler. These languages tend to be 2x or more slower than C++ at most tasks and have significantly larger memory footprints. It may be possible to have those features without that cost, but nobody has that language that I know of.
C++ doesn't have this ability. Instead, it forgets almost all facts about types during compilation. For any, it remembers a typeid which it can be used to get an exact match, and how to convert its storage to said exact match.