A Canadian firm that “mines” bitcoin has returned to profitability, offering a unique look at the impact a recent rally in the cryptocurrency has had on an opaque industry.

Toronto-based Hut 8 Mining Corp. said it swung to a profit from a year-ago loss, and that revenue more than tripled. Its results last week show how the fortunes of crypto companies tend to rise and fall along with bitcoin’s notoriously volatile price.

The...