Hi Ashit,
It seems you want some thing like the buyers to decide what component (X/Y) they want in the final production.
This can be achieved with variant configuration.
I suggest you google for "variant configuration" as this is a vast topic and cant be explained in just one reply.
Thanks and regards,
Suraj Kamble