In real life, a vivarium is essentially a glorified greenhouse: A large room with carefully controlled light, temperature, and humidity set to match specified conditions. It is most often used to maintain a suitable habitat for species that have been transplanted far from their original ecosystem, such as African orchids in England.
In DF, a vivarium would be not so much a room as a designation of a room, like a tavern. It can be any size, but must* be almost completely enclosed. The size is not determined by the player; rather, they simply place the cursor, and any tile that shares airspace with the cursor (everything bounded by doors, hatches, walls, floor, or ceiling) is considered part of the vivarium. When the vivarium is designated, the game calculates the average temperature (even if the temperature is turned off), humidity, illumination, and rough O2 / CO2 balance within the enclosed area. It will then treat the vivarium as its own self-contained biome, enabling players to construct and control environments quite different from their outer surroundings, and import species that ordinarily would not be able to thrive in the area. Vivaria will appear in the Locations menu, allowing you to view (and tell the game to recalculate, which is also something that should automatically happen every year or so) the conditions there.
Vivarium calculation boundaries do not actually stop at the first wall or door at the edge of the region, but rather at the second one. This will enable things like running magma pipes next to or below a room to heat it, or necessitate "airlock" rooms to insulate the vivarium from direct contact with the outside air.
* Any vivarium designation with an uninterrupted "path" to a map edge takes the base climate conditions of its biome; it can still be viewed in the vivarium menu, but only as a "control", to see how your enclosed vivaria compare with the natural climate of the region.
Vivaria would be useful because A. they would allow the player realistic climate control, and B. would impose only a relatively minor drain on a fort's FPS. Even in a vivarium the size of an entire cavern, calculating the weather once a year would be a doddle, compared to checking the temperature 24/7 over the entire map.
Other possibilities include influencing the vivarium's Good/Evil conditions, by introducing living quarters for elven residents or a caged necromancer.