You connect to proxy 1 and ask it to set up a tunnel to proxy 2 (the tunnel to proxy 2 rides inside the tunnel to proxy 1).
Proxy 1 knows your source IP, its own IP, and the destination IP (proxy 2). Proxy 2 knows the incoming source IP (proxy 1), its own IP, and the destination IP (the website you're accessing). Neither proxy knows both your IP and your destination IP.