Firstly, what does it mean "A proxy is something that acts on your behalf"? Can anyone give a more detail explanation about proxy? I read a number of papers but still bit confused
The client connects to the proxy, either explicitly (configured as proxy in browser) or implicitly (transparent proxy). The proxy then looks at what the client wants (i.e. access web site) and executes this. This means the client does not get the web site by itself but it instructs the proxy to get the web site and then gets the data from the proxy.
Secondly, how can application proxy know if the incoming data is safe or not?
They don't really "know" fully if the incoming data are secure. But they can check if the application protocol is valid, can check the payload for malware signatures, extract suspicious payload and execute it inside a sandbox etc. This way they can detect at least part of the unsafe content.
Thirdly, how does a proxy function if i am going to send packets to external network
If you don't send the data to the proxy but directly to some external network than the proxy must be somehow in the path. This is usually on a firewall where packet filter rules redirect your traffic to the proxy for analysis.