go to triggers. make a new trigger and go to new effect. under the effect drop list, by the bottom, it will say change object name. click on that and type in whatever name you wish. then go to set objects ( to the side of the text box, you cant miss it) click on set objects and click on the unit or building you would like to name. now test the scenario and if you did this corectly you should find that the unit or building's name has changed to what you wanted it to be.
you canot make units have a changed name if the unit is made with triggers. ( creat object )
you can name more than one unit at once by going to the set objects button and double cliking on a certain type of units. doing this however makes all the units selceted have the same exact name.