  The innate complexity of solid state physics exposes superconducting quantum
circuits to interactions with uncontrolled degrees of freedom degrading their
coherence. By using a simple stabilization sequence we show that a
superconducting fluxonium qubit is coupled to a two-level system (TLS)
environment of unknown origin, with a relatively long energy relaxation time
exceeding $50\,\text{ms}$. Implementing a quantum Szilard engine with an active
feedback control loop allows us to decide whether the qubit heats or cools its
TLS environment. The TLSs can be cooled down resulting in a four times lower
qubit population, or they can be heated to manifest themselves as a negative
temperature environment corresponding to a qubit population of $\sim 80\,\%$.
We show that the TLSs and the qubit are each other's dominant loss mechanism
and that the qubit relaxation is independent of the TLS populations.
Understanding and mitigating TLS environments is therefore not only crucial to
improve qubit lifetimes but also to avoid non-Markovian qubit dynamics.
