While I understand how GPS receiver finds its distance from GPS satellites and exact position using trilateration, I still do not understand how is GPS system able to find the latitude and logitude coordinates(for example X:6274419 Y:650167)? How does this work?
The GPS receiver projects the XYZ coordinate that it finds from trilateration (or quadrilateration) onto a oblate spheroid model of the earth to find the latitude and longitude. Some fancier chipsets even have a (very coarse) height model of the earth that it uses to back-calculate latitude and longitude.
The GPS signals contain not just ranging but also ephemeris data (i.e position of the orbit) as well as the calendar that includes the status of the entire network. If you know the relative distance from the satellites and the position of the satellites, you can determine your position on the earth.
In effect each satellite transmits it's location and a time stamp regularly.
Now if you imagine for now that instead of satellites you are on a long straight road with a transmitter in front of you and another behind you from the signals you receive you can calculate the time difference you would have seen between the signals arriving had both transmitters transmitted at exactly the same time. This gives you your exact distance from both transmitters and hence your exact position in 1 dimension.
With 4 transmitters you can calculate your position in 3 dimensional space.
For this to work the transmitting satellites need to know there location and time to great accuracy and GPS receiver needs to be able to measure small time differences accurately but does not need to know the actual time as its only ever working with time difference.