When you say tax, this is considered to be a type of financial obligation that you will be required to pay for the government.
For example, if you are working, you know that you would need to pay taxes because this is the money that will be used by the government in order to improve the country that you live in. When you say duty, this is a type of tax but it is more specific because it is focused more on goods.
For example, if you would bring a lot of items from another country, you can expect that you would need to pay a duty for it so that you can bring it home with you.