This paper studies the optimal control with stabilization issue for a class of hybrid dynamical systems (HDS) with hybrid performance functional (HPF). By employing Lyapunov function method and the recent results of stability of HDS, the optimal control conditions for the HDS has been derived with respect to the HPF. Under the state feedback control, the closed-loop HDS is globally asymptotically stable (GAS) and at the same time the HPF can achieve the desirable maximal (minimal) value. The results are then used to study the case of linear HDS with hybrid quadratic performance functional (HQPF). The matrix inequality conditions are derived to design the linear feedback controller under which the closed-loop linear HDS is GAS and the HQPF is optimized. Finally, one example is given for illustration.