How do custodial lightning wallets work? I just installed and tried to use a lightning wallet (bluewallet) on an Android device.

As per my understanding, when I fund my lightning wallet (This is an on-chain tx) with amount x, I open a direct channel with blue wallet of amount x. If I want to send a tx on the lightning network (say amount x) to a person B, they must have their own open channel with bluewallet of amount y where y must be greater than x for the tx to go through. If it goes through then it's routed via blue wallet to person B.

Is my understanding correct? Please correct me if I'm wrong.

What happens if the above conditions are not met, i.e. person B creates a wallet on blue wallet but doesn't fund the channel? What happens if the amount y is less than x?
Also, are my keys randomly generated on device only?
I am sorry to say but your understanding is wrong.

When you send x btc to Bluewallet you don't open a channel. You just give them your Bitcoin. Bluewallet and other custodial wallets run one (or possibly several) lightning nodes and allow you to use it with up to the amount of btc you have sent to them before.

So as long as Bluewallet users send each other payments no channel is needed as everything can just happen virtually in their accounting software. Also in a custodial wallet you can receive btc via lightning without providing liquidity first (as with your non custodial fullnode)