This very much depends on what you mean by
Bob trusts Y.
If Y is a root CA and Bob "trusts" them to do their job properly, then yes he would trust Alice's key. This is because the job of a root CA is exactly discerning whether a subordinate CA (in this case X) should be trusted to in turn do their job: I.e., check people's identity and sign their public keys if and only if they can be certain beyond reasonable doubt that the person presenting the public key is in possession of the corresponding secret key and that they are the entity they claim to be.
If on the other hand Y is just some random friend ob Bob, whom he trusts in the sense that they are sure that the key they is theirs and they probably genuinely believe whatever it is they signed with that key, then no, this is no basis to trust Alice's key. In fact in general Bob has no way of telling in what context and why Y ever signed X's key.
Which means that we lack the necessary information to answer the question, because the statement "Bob trusts Y." is underspecified.