If someone want to send me an invitation letter from Poland, what is the government institution responsible for that? And he can cancel it during visa process and put me in bad situation? And if I got the visa then he cancels it, will it affect me at the airport? And how can the embassy make sure for that invitation letter?
As far as I know, decisions are based on the document itself. It's only one element in the application like the rest of the supporting documentation you have to submit. Depending on the country and the type of invitation, it might bear some stamp or official signature that authenticates it (typically from a municipality) but it's probably not matched with a database and I am not sure whether consulates routinely contact anybody to verify them (although they obviously might).
Now, your comments to this and another question suggest that the invitation in question does not really exist anymore (i.e. you might have a letter stating this or that in your hand but you are not actually invited to participate in anything). If you apply for a visa based on this letter, you would submit materially incorrect information to the consulate and actively misrepresent your situation and intent. That's fraud, plain and simple, and could have very serious consequences. I don't know whether the consulate can easily detect it (they might notice something, e.g. during an interview) but that's still risky.
Ultimately, the invitation is just a document that attest something. What matters here is the underlying reality: The fact that you intend to participate in the project and that your host confirms that. If that's not true anymore, you should not hope the invitation to produce any effect. Because of this, a simple phone call would be enough to create serious difficulties for you. There is no need to formally cancel anything.
And fraus omnia corrumpit, any visa obtained that way can be annulled at any time, with all associated consequences up to detention, removal and a massive reduction of your credibility for any further visa application. You ask about the consulate and the border but an anonymous tip after you have entered the country would be enough too. If you do not intend to participate in this project, you should not pretend that you do.