1) If polygamy is not recommend why did the Prophets do it?
2) Also why isn’t it obligatory for a man to inform his wife before getting a second wife? wouldn’t that be considered deceiving someone?

1- The Prophet married numerous wives for many reasons. Very briefly:
-Create alliances with tribes in order to bring peace and stability to society
-Take care of widows (he was leading by example)
-Encourage people to free slaves. Sometimes the Prophet would free a slave and marry her, and that encouraged hundreds of people to free their slaves
-Bring religious tolerance. Foe example, he married a woman who was previously a Christian and one who was Jewish. This taught Muslims not to discriminate against other religions.

And many other reasons

2) A man, per Islamic law, is allowed to marry more than one wife (of course he should have a legitimate reason to). So if he uses his right, he is not deceiving his wife. Deception is when you lie and fabricate. Yes, if he promised his wife (when doing the marriage contract) that he would not marry someone else without her permission, and then he violates this condition, that would be deception.