This paper presents a mathematical theory of behavioral swarms, where the state of interacting entities, which are called active particles, includes in addition to position and velocity, an internal variable, called activity, which has the ability to interact with mechanical variables thus affecting the interaction rules. In turn, the mechanical variables can modify the dynamics of activity variable. This approach is useful for describing the dynamics of living systems with a finite number of interacting entities. This paper provides a general conceptual framework that extends the pioneering work [N. Bellomo, S.-Y. Ha and N. Outada, Towards a mathematical theory of behavioral swarms, ESAIM: Control Theory Var. Calculus 26 (2020) 125, https://doi.org/10.1051/cocv/2020071 ]. The theory is firstly developed for the constant number of active particles. Then, it is considered for the case of particles tending to infinity. This theory is useful for describing the dynamics of living systems. Therefore, it provides the conceptual basis for developing a mathematical theory of behavioral swarms, which naturally lead to the study of a theory of swarm intelligence. A study of the dynamics of swarms shows how the theory can be applied to real world collective dynamics.