On June 17, 1857, Denver was appointed by Buchanan as Secretary of the Kansas Territory. In December 1857 he was appointed as Territorial Governor. On the day that Denver assumed the territorial governorship, citizens in the territory voted on the Lecompton Constitution, which opened the territory to slavery. The vote offered a choice only between full slavery and limited slavery in the territory and was thus largely boycotted by Free-Staters who were in favor of abolishing slavery. The pro-slavery constitution passed by an overwhelming margin. Later it was discovered that several thousand votes were cast fraudulently by "border ruffians" who had crossed into the territory from Missouri in order to cast pro-slavery ballots (The vote was overturned by a subsequent election in August 1858, and Kansas was later admitted to the Union, in 1861, as a free state. See Bleeding Kansas for details.).

General James W. Denver

In November 1858, while Denver was still serving as territorial governor, William Larimer, Jr., a land speculator from Leavenworth, planted the townsite of "Denver City" along the South Platte River in Arapaho County in western Kansas Territory (the present-day state of Colorado). Larimer chose the name "Denver" to honor the current territorial governor with the intention that the city would be chosen as the county seat of Arapaho County. It was actually William McGaa and William Larimer who got the settlement of St. Charles at the confluence of Cherry Creek and the South Platte River to change its name to Denver in hope of becoming the county seat.

Denver retired as territorial governor in November 1858 and was reappointed Commissioner of Indian Affairs, serving until his resignation on March 31, 1859.

A few months after the start of the American Civil War in early 1861, President Abraham Lincoln commissioned Denver a brigadier general in the volunteer army on August 14. In November 1861, he was ordered to report to Fort Scott in Kansas and in December, he assumed command of all Federal troops in Kansas. During March and April 1862 he commanded the District of Kansas until he was transferred to the District of West Tennessee. On 16 May 1862, Denver assumed command of the 3rd Brigade/5th Division under Maj. Gen. William T. Sherman in the midst of the Siege of Corinth. The very next day Denver's brigade participated in the fight for Russell's House. Though his brigade suffered no casualties in this engagement it was nonetheless one of the two brigades leading the attack.[1] On May 27 General Sherman again selected Denver's brigade to be one of the leading units in an attack against the Double Log House. Denver and Morgan L. Smith's brigade successfully stormed the log cabin turned block house. During this engagement Major General Ulysses S. Grant was present on the battlefield and indicated his approval of the handsome manner in which the troops behaved.[2] After the fall of Corinth Denver continued in command of his brigade, serving on garrison duty in Mississippi. During the early stages of the Vicksburg Campaign Denver was in command of the 1st Division, XVI Corps until his resignation from the Union Army on March 5, 1863.

After the war, Denver practiced law in Washington, D.C., and Wilmington, Ohio; he and his family lived in the Rombach Place while residing in Wilmington.[3] He served as a delegate to the Democratic National Convention in 1876, 1880, and 1884. He was mentioned as a possible Democratic presidential nominee in 1876 and 1884, although his name was never offered into formal nomination.

Denver reportedly visited Denver, Colorado in 1875 and 1882, but complained that his visits received little affection from the residents of the city named after him.[4] The second visit makes Denver the only person to have spent time in his or her namesake city after it became a U.S. state capital.

He died in Washington, D.C. in 1892 and is buried in Sugar Grove Cemetery in Wilmington, Ohio.