How do I calculate x and y in km, between two points?

If I interpret your question correctly, you most likely want “how far do I need to go east (or west) along my current latitude to reach the same longitude as the other point?”.

Be aware that the answer will be slightly different depending on whether you start from A or B if their latitudes are different. Be also aware that it is subtly different from “how far do I need to walk to reach the same longitude as the other point”, since this will follow a great circle not exactly due east (or west). (Extreme case: consider antipodal points on the equator)

But what you want to know is: on a sphere, the distance between longitudes scales with the cosine of latitude. X-delta = longitude-delta * cos(latitude) * 111km/deg