How to convert 220V AC @50 Hz to 400V @ 20KHz?
You ought to consider converting to DC then converting back to AC because directly trying to change frequency A into frequency B is too hard to do.

That's what I would do. Consider rectification of the incoming AC and smoothing with a capacitor. This will give a DC value of 311 volts. Next, using a MOSFET H bridge driver and a 2:1 step-up transformer you should be able to re-create 400V RMS at 20kHz.

For your own safety I would also consider isolating the incoming mains AC via a 1:1 isolating transformer. 

Another method is to start from a lowish DC voltage (as supplied safely from a power supply) and use a MOSFET H bridge driving a step-up transformer to give you 400V AC. If your power supply is 24V then you'll need a 24:1 step-up transformer.