It's a nickname used by people when referring to them which is either based on their abilities, position and because they didn't know their real identity. Natsu is called Salamander because as described by happy in the first episode fire has no effect on natsu and natsu can literally eat fire as he uses dragon slayer magic just like the mythological Salamander who is immune to fire. Natsu didn't know the Salamander that the people are talking about was him and he thought they were talking about to igneel that is why he went looking for him but all they saw was bora who is a fire magic user.
As for Erza she was called Titania because of her magical strength and abilities which is known all over magnolia town and the kingdom of fiore and since she is a member of fairy tail and someone who is feared and respected among the guild she was seen as the queen of the fairies also known as Titania who is also a character from shakespeare's play A Midsummer Night's Dream and the queen of the fairies.