Is is compulsary that I surrender my passport??

I will be travelling to Italy next July/2018& I've heard about hotels asking travellers for their passports. People have said they take the passport, then give it back to you at checkout. I find this unnerving. I've also heard they take the passport, record information from it, then give it back to you....

Yes, it is, but they don't keep it until you leave. Italian law requires visitors to register their presence with the police. Rather than you going to the police station, hotels make a copy of your passport information page and send it to the Questura when you register; you get the passport back when the copy has been made.