Sort:  

We need to bring our passports when traveling from one country to another because it serves as a means to filter and control the movement of people across borders and it provides us with an internationally recognized document to identify us.

A passport is a travel document. It is issued by the government that a person is a citizen of as proof of the person's identity and nationality. Requiring foreigners passing into a country's borders to show their passports allows a country to identify who is entering and who is going out. This serves as a means of policing, so that countries can keep undesirable people out. These includes terrorists, criminals, and individuals from countries that the receiving country has not allowed to enter. It is also a way to keep individuals restricted from travel from leaving his or her home country.

Your passport also serves as a proof of your nationality. If you should ever need the assistance or services of your home country while in a foreign land, your passport is the proof that could identify you as a citizen of your country. 

Finally, your passport is also the only proof of identification that hotels and other establishments will accept from foreigners. When you check into a hotel or go into an establishment that requires its customers to present an ID, your passport is often the only form of identification that will be accepted abroad. So, without it, you might not be able to check in at your hotel, transact at a bank, or receive services. 

That's why we all need to carry our passport when we travel. Otherwise, we won't be able to enjoy our travels because we might be denied services or our home country might not recognize us. And of course, carrying a passport is a way of helping governments police their borders.

Source:

Passport: https://en.wikipedia.org/wiki/Passport

It basically has to do with the fact that it's an international standard, so everyone has one independently of which country they are from. Other types of identification varies between countries, so passports are a nice way to be able to ID everyone who enters the country. 

And it's not like you need a passport to enter all countries either. For example, here in Norway we can freely enter most countries in Europe without a passport as long as we have another type of identification, such as a drivers license. 

As to why you need identification in itself, it's to make sure that no one enter the country illegally by faking to be someone else. 

Usually a country issues for its citizens an ordinary passport for regular trips. For some people a diplomatic passport is issued which identifies them as diplomatic representatives from their home country. This Passport holder enjoys some ease of treatment and immunity in the country they are in charge of. In Indonesia, this passport is given a black cover and issued by the Ministry of Foreign Affairs.