Modern power systems require flexible demand-side resources to maintain the balance between electricity supply and demand. Building thermostatically controlled loads (TCLs) are great flexible assets, as they account for a significant portion of electricity consumption in buildings. In this regard, demand response (DR) programs have long been used by grid operators to enable the coordination of TCLs to reveal and utilize this demand flexibility. Existing efforts in DR are mostly model-based, which is not scalable because gathering the physical parameters and developing an accurate model for each participating load is impractical. To address this limitation, this paper proposes a data-driven, distributed hierarchical transactional control approach, which leverages concepts from machine learning, game theory, and model-free control. In this approach, the interactions between a distribution system operator (DSO) and load aggregators (LAs) in the upper level are designed as a Stackelberg game, where the DSO is the leader and the LAs are the followers. The DSO aims to maximize its profit and minimize the total demand peak-to-average ratio (PAR) of the system, whereas the LAs aim to minimize their electricity cost while maintaining the quality of service provided. In the lower level, the LAs control the individual loads of end users while tracking the optimal aggregated load profile passed from the upper level. The performance of this approach is evaluated using a case study with a single DSO, three LAs, and 300 TCLs. The results show that the total demand PAR is reduced from 1,38 to the range of 1.17 and 1.26. The cost of an LA is reduced from $5,790 to the range of 4,424 and $5,437 while still maintaining the comfort of end users, but the profit of the DSO is reduced from $13,374 to the range of $10,084 and $12,904.