Confirmed it's the doorbell transformer. (I discounted one wire and the doorbell would not ring.)
The house was built in 2000. (I'm not the original owner.) Wondering why they left this ugly transformer exposed on the ceiling. Will try to cover it up.
Thanks, everyone.