I assume you are talking about a personal home you live in.
In this context a house generates income by reducing a non-optional expense. [1]
In other words, once paid off, you are living rent free[2]. Since housing is usually a large part of any budget, this is a significant cash-flow gain.
While paying it off it also has the effect of "fixing" rent [3] - potentially over a long period of time. This can work as a hedge against inflation - or to put it another way, in inflationary environments it can cause your housing cost to diminish.
Ownership also provides a hedge against rampant house price inflation,which drives up rent.
Lastly it acts as a store of future value[4]. If the market goes up then "downsizing" on retirement can free up cash. If the market goes down, then you have a place to live rent free. Either way you have a place to live.
Whether home ownership is the right option for you depends on your circumstances. It can be a critical investment for some, or a hindrance to others.
[1] there are clearly enormous differences in housing costs based on location, size and condition. You may get better returns by simply renting a cheaper house, and investing the difference.
[2] while you won't pay rent, or mortgage, you will encounter very real maintainence costs and taxes. These will be less than rent, but still a very real number > 0.
[3] if your mortgage interest rate is flexible then inflation will likely drive up interest rates, but this is a secondary effect and applies to the interest portion of loan repayment, not the capital portion. This can change literally overnight, a renter typically is insulated from this for the duration of the lease, but may then see an exaggerated increase on the next lease.
[4] assuming you buy a house you can afford. If you reach for something you can't ultimately afford it will likely end badly.