When you visit a new country, the government there wants to be sure that you have permission to be there and that you will follow their rules while you are there. They will check your passport to make sure it's valid and has not been tampered with.
To show that they have checked your passport, they will usually make a mark or stamp on one of the pages. This is like getting a sticker or a stamp on a piece of paper in school when you do a good job. The stamp will usually have some important information on it, like the date you entered the country, the name of the border agent who checked your passport, and maybe even the type of visa you are using to visit the country.
People often like to collect these stamps in their passports as a way to remember all the places they have been. It's kind of like collecting stickers in a scrapbook!