I hear a lot about offshore and onshore currency, but I don't understand the difference between them. What is the difference between onshore and offshore currency in a country? Besides that, why is there a need for having two different currencies in the country??
Certain regulations in a country might inhibit the values of a unit of currency from being the same within the borders of the country and outside. There might be foreign exchange or banking regulations.
For example, the eurodollar rate is different from the dollar inside the US, since there are reserve requirements dictated by the Fed.
Basically, same underlying currency just different regulatory regimes give rise to different values.
It's because of onshore capital controls; units of currency cannot freely enter and leave the country and so currency held onshore (within the domain of the capital controls) is not fungible with currency held elsewhere. Hence, due to the limitations of arbitrage, those two currencies are not tightly coupled. They are related, since actual physical onshore exporters may be allowed to accept offshore currency (or vice versa for importers), but not perfectly.