So I bought Terraria from steam, and I want to send a copy to my friend for his birthday as a gift. Will doing this delete Terraria from my computer or just buy a whole new version of it for him?
If you already have the game, then purchase your second copy by selecting the option to buy it as a gift. This will put a copy of the game in your steam inventory and will not affect your copy of the game at all. Go into your steam inventory and select the game, then select the option to send it, either through your friends list or through e-mail.
If you are purchasing from the store it will have two buttons to click on
Purchase for myself
Purchase as a gift
If you have already purchased it for yourself then the Purchase for myself will be grayed out and you can only purchase the game as a gift.
The game can either be sent to him via email,
Through steam as friends(No need to open a trade window, also sends by email)
Kept in your inventory (To be gifted or traded later)
You can not gift games that are in your library. You can only gift 'non-active' copies of a game. Such as a gift item in your inventory. If you don't have the game yourself yet you can 'unwrap' the gift to add it to your library but you would not be able to gift it anymore. If you have the game in your library and purchased a second copy you should be able to give it to your friend. It will not be removed from your library.
Normally you can not remove any game from your library. This functionality came recently to steam but requires you to contact the steam support. Check out this answer for more details about how to remove a game from your library (which is not what you want I suppose).