Well, it sounds like you have a lot of ground to cover in just two days. Is this correct? If so, you will need to move fairly quickly, which will limit your choice of roads you can take, and thus your exposure to scenery along the way.
I have done that trip a couple of times, but on one of those times, I spent two nights along the way. When I did that, I traveled north on I-25 to Cheyenne, then west on I-80 to Rock Springs. This had some pretty places along the way, but not as many scenic opportunities as some other routes you can take. From Rock Springs, where I spent the first night, I headed north on US 191 through Pinedale, and on up to Hoback Junction. From here you can continue north on US 191 through Jackson and Grand Teton National Park, then on up to Yellowstone. When I did the trip, I detoured south on US 89 at Hoback Junction, where I did a small loop through a portion of Idaho before heading back to Jackson. This added a couple hours to my trip, so you should be able to make better time than I did then. I spent my second night on this trip camping in GTNP, and headed up through YNP the next day, and drove past the north entrance on my way to the northeast entrance, where I exited the park. The drive from Jackson through GTNP and YNP will take the better part of a day by itself (even without making many stops), so if you only have two days to make the trip, I'd recommend traveling as far as possible towards Jackson from Denver on the first day if you elect to take this route.
Other possible routes, though I haven't taken them yet, involve traveling further north on I-25 before heading toward YNP. For instance from Casper, you can take US 20 into YNP, which takes you through Worland and Cody. Another option is to take US 26 into YNP, which takes you through Riverton and Dubois, then into GTNP, where you can then turn north to YNP. Other options include staying on I-25 until you reach either Buffalo, or until you merge with I-90 and continue to Sheridan, where you can take any of a number of routes through the Bighorns to reach YNP.
One final option to consider, especially if you're pressed for time, is to take I-25 until it merges with I-90, and continue taking I-90 west into Montana, until you reach Billings. You could spend the night there, then head towards the NE entrance of YNP and into the park the next day. This route takes you through Laurel and Red Lodge, then over the Beartooth Highway before heading into YNP. The scenery along the last leg of this trip is absolutely gorgeous and will take your breath away in many places. From Billings, the drive over the Beartooth and into YNP should only take about a half day, which should give you a little time in the park before you head out again. The first day of this trip will take you mostly through the prairie of eastern Wyoming, but you'll be close to the base of the Rockies most of the way. With what you've written about your projected time frame, this would be the route I would recommend to reach the north entrance of YNP on the second day of your trip. As with my first suggestion, I've also taken this route myself.
Other than the last route I've suggested, I would recommend taking more than two days to reach your destination. Even the last route mentioned will take some time for you to get from Denver to Billings. According to Goole maps, it's a little over 7 1/2 hours, and that does not include making any stops along the way. I've found that Cheyenne has some interesting things to see and do (as do some of the other towns along the way), so you may want to stop there along the way. If you like trains, there is a UP Big Boy steam locomotive on display in Holliday Park, not too far from I-25. There is also a smaller steam locomotive on display in Lyons Park, near the Cheyenne Botanic Garden and the nearby Western Museum. These are also interesting things to see. Here is a link to points of interest in Cheyenne:
Welcome to Cheyenne, Wyoming
Hopefully all of these suggestions aren't overwhelming when you read them. I've included them to give you some ideas about various routes to take, but you'll want to explore your options before you make a decision. From my experience, I'd recommend the last option, stopping in Cheyenne for some fun and interesting things to do along the way, before heading to Billings. If you want more information about the routes I've suggested, or my experiences on the routes I've taken, just ask.