Government stimulates demand by investing in sectors that have huge up-front costs but large positive social externalities over time because the lifespan of a gov is much greater than that of an individual or corporation. It invests in infrastructure - the national grid, highways, roads, prisons, the post office, mortgage lending, insurance - most importantly though, wars, education, and healthcare. Many of these industries have become increasingly privatized over the past 30 years. This is not inherently bad, but it changes the profit time horizon and shifts incentives away from long-term investment towards short-term profit maximization.
iPhone would not exist without the development of the internet during the cold war on gov grants, the affordability and draw of public UC Berkley where Jobs and Wozniaki met, people alive and well-fed enough to buy it, etc. You can't point to a single innovation without looking at the entire fabric of the society that produced it. Gov spending has huge impact on social fabric. iPhone is also only one half of equation. If no one has the disposable income to buy one, it doesn't matter how good it is.