Injunctions are either prohibitive (they prevent action) or mandatory (they order action). They can be temporary or permanent, and are entered either without a court hearing, or after an evidentiary hearing, at which witnesses testify and documents are placed into evidence.
Contracts can give a right to obtain injunctions for many reasons, and the law gives that right in other situations. In general, to get an injunction, you need to show that without it, irreparable injury will result (it cannot be compensated for with money), and that the facts are substantially in your favor.
Injunctions are routinely entered to enforce non-compete clauses, stop interference with business contracts or relationships, prevent directors and officers from breaching fiduciary duties, stop squeeze-outs of minority shareholders, abate public nuisances, stop unfair and deceptive trade practices, stop unauthorized use of a name or trade secret, stop fraudulent transfers of assets, and in landlord tenant cases, to name just a few.