The simple answer to your question is that inflation happens when the money supply outpaces the productive capacity of the economy. What's more, government borrowing does not increase the money supply in and of itself.
First, let's recall that inflation happens when there is an undersupply of goods relative to the amount of money in circulation---or when there is an oversupply of money relative to the quantity of goods available for sale. Increasing the money supply may lead to inflation depending upon the level of output.
As I wrote above, if a government borrows an additional dollar from the public markets, no new money has been created. For example, the US Treasury coordinates Treasury bill, note, and bond auctions to ensure that the government has available to it funds to meet its ongoing expenses. Certain banks called primary dealers must submit bids for those Treasuries, hence those bonds are always bought, no matter market conditions. What's more, those primary dealers buy those bonds with customer deposits, the savings of institutions and households.
The Fed and other central banks can make minor adjustments to the size of the money stock by influencing money creation among private banks. I urge you to read about the money multiplier to get a better handle on how central banks change policy to influence money creation among those private banks. You'll want to read about M0 and M2, and you will want to read carefully how M0 expands into M2 as banks make new loans to businesses and households.
I should stress that central banks are highly data dependent and respond to figures that not only indicate current GDP growth, but projected growth. They do not influence money creation proactively.
Let's think carefully about a couple of different scenarios so that we see your examples in action.
Imagine your government borrows $50bn to build new roads. When there is high unemployment and low utilization---demand for cement, rebar, trucks is low---building roads will likely not be inflationary. If the construction sector is at full employment, however, orders to build roads will drive up wage costs. Likewise, if private and public developers compete for cement, additional plans to build roads will likely bid up the value of cement.
Imagine the government borrows $50bn to insert into everyone's bank accounts. The answer depends upon whether that money will be spent immediately. If it will, then yes, consumers will likely bid up the value of goods with their new money, hence such government action will lead to inflation. If, however, that money will not be spent, then the government has done nothing but engaged in an accounting transaction. Imagine that everyone took their share and paid down mortgage debt. What has happened but that the government replaced private sector mortgage debt with public debt?
Lastly, there are those that would like you to believe that "inflation is everywhere and always a monetary phenomenon." That line comes from Friedman, and should be interpreted loosely. If you were to look at M0 in the US from 2008 onward, you would be shocked by its growth. However inflation has been extraordinarily subdued since the crisis. Look at M2 however, and it becomes clear that despite extraordinary Fed action, the supply of broad money has not grown. That's why inflation has remained low. How you measure money matters.