1) Is the X-CTU is an open source software or not? If yes where can i find the source code?

  1. How does the X-CTU particularly discovers the gateway when it is attached to COM port?

No XCTU is not open source.