While it is certainly possible that the investor is purchasing existing shares from someone -- it is far more likely that they are looking to invest their money in the company to see it grow and provide him a return on their investment.
As part of the conversations with the investor they may even be a conversation about the use off the funds. This is the investors expectation of how his money will be used to grow the company. the money will go into the corporate account and be spent by the corporation in accordance with corporation policies.
When a new investor comes in this situation the current shareholders are "diluted"-- this means that the new shares issues by the board of directors -- hopefully from un-allocated shares identified in organizational documents so that no filings will need to be made and legal cost incurred -- will decrease the relative percentage of the company of the current shareholders proportionally to their initial investment.
Before the investment John and Dan together owned 100%. After investment together they will own 80%. John will own 70% of 80% and Dan will own 30% of 80%. This means that John will own 56% and Dan will own 24%
Based on the numbers that you provided the investor has a post money valuation of the company of $500,000 (Based on $100K garnering 20%). This means that the shares now held by John and Dan are worth 280,000 and 120,000 respectively.
I will assume based on your question that this is the first time you have been in a position like this. You are about to change your relationship with your own company. Whether you are John or Dan -- you will not be working with other peoples money. Not just your own. Other people's money. Your legal, professional and ethical responsibilities are now different. Be sure to take that change seriously. Be sure that you are ready. Be sure that you have the professional and personal support systems in place to ensure success.