David's request for an eternal royal dynasty is a bold one, yet it does not stem from personal ambition or a sense of entitlement. The primary approach among commentators is that his prayer relies entirely on a prior promise from God. God Himself initiated the communication, revealing His intention to establish a permanent royal house for David's descendants.
Because of his humble beginnings, David viewed himself as completely unworthy of such greatness. Had God not taken the first step to promise these future blessings, David would never have even considered asking for them [רש״י]. It was the divine promise itself that gave him the courage and inner strength to approach God and make such an enormous request [מצודת דוד]. This promise served as the foundation for his prayer, allowing him to blend deep gratitude for the blessings he had already received with a hopeful plea for the future that was assured to him [ביאור שטיינזלץ]. Ultimately, David is not asking for a new favor or an unearned privilege. Instead, he is simply turning to God, asking that He confirm and fulfill the very promise He Himself had already made [רש״י].