The 25 BTC are actually generated out of thin-air. Essentially every peer in the network knows to accept blocks where the first transaction in every block should be of maximum 25 BTC. If it's more, then the block is considered invalid. Note that these are the coins given to the miner since the miner is the one creating the block and can therefore set to which address these 25 BTC go to. Also note that 25 is not an hardcoded value, it changes with time. Again, there's another rule "programmed" into each peer where they can calculate the current reward. Currently the maximum allowed is 25, but every certain amounts of blocks, peers know that the value needs to be halved - it was originally 50 BTC, now it's 25, next it will be 12.5.
So to answer your question, peers collectively know that the rule is to generate coins out of thin air every so often, and the person that gets them is the person that mined the block. You might be asking: what if a dishonest peer changes the 25 BTC transaction to go to himself rather than the miner. They can't do this because they would need to re-mine that block (changing contents of a block also changes its hash).