The idea that it is possible to take communion unworthily originates from a teaching by the Apostle Paul to the church at Corinth. It’s a lengthy read, but definitely always worth it in the Word:
1 Corinthians (11:17-34 ESV):
The Lord's Supper
17 But in the following instructions I do not commend you, because when you come together it is not for the better but for the worse. 18 For, in the first place, when you come together as a church, I hear that there are divisions among you. And I believe it in part, 19 for there must be factions among you in order that those who are genuine among you may be recognized. 20 When you come together, it is not the Lord's supper that you eat. 21 For in eating, each one goes ahead with his own meal. One goes hungry, another gets drunk. 22 What! Do you not have houses to eat and drink in? Or do you despise the church of God and humiliate those who have nothing? What shall I say to you? Shall I commend you in this? No, I will not.
23 For I received from the Lord what I also delivered to you, that the Lord Jesus on the night when he was betrayed took bread, 24 and when he had given thanks, he broke it, and said, “This is my body, which is for you. Do this in remembrance of me.” 25 In the same way also he took the cup, after supper, saying, “This cup is the new covenant in my blood. Do this, as often as you drink it, in remembrance of me.” 26 For as often as you eat this bread and drink the cup, you proclaim the Lord's death until he comes.
27 Whoever, therefore, eats the bread or drinks the cup of the Lord in an unworthy manner will be guilty concerning the body and blood of the Lord. 28 Let a person examine himself, then, and so eat of the bread and drink of the cup. 29 For anyone who eats and drinks without discerning the body eats and drinks judgment on himself. 30 That is why many of you are weak and ill, and some have died. 31 But if we judged ourselves truly, we would not be judged. 32 But when we are judged by the Lord, we are disciplined so that we may not be condemned along with the world.
33 So then, my brothers, when you come together to eat, wait for one another— 34 if anyone is hungry, let him eat at home—so that when you come together it will not be for judgment. About the other things I will give directions when I come.
Communion is an act of worship meant to signify and glorify the remembrance of Jesus’ sacrifice on the Cross, and to also show love and unity among fellow Christians in the body of Christ. But, as related to the Corinthians, it was instead multiplying the divisions among them. Thus, they show how it is possible to participate in taking communion in an unworthy manner, and by doing this they were doing more harm than good.
The act of communion should honor Jesus completely - not man. Paul shows how the Corinthians’ practice - and perhaps our very own in our lives - was incorrect. Focusing in specifically on 1 Corinthians 11:20-22, Paul talks about how the Corinthians have private dinners at home or undisclosed locations instead of in an all-inviting church, and as a result, some go hungry and don’t eat while others get drunk (and eat plenty!). This type of stuff should be saved for your homes or social gatherings, like parties, festivals, or home gatherings - but they should NOT be considered honorary of Jesus.
All in all, the Corinthian’s communion gatherings had turned into a corrupt act of defiance against the poor and uninvited, full of selfishness, proclaimed groups, and drunkards. They were not honoring Jesus in any way, nor were they helping each other for that matter, further plunging each other into gluttony. If you find yourself in a church that participates in Communion in this manner - like more of a party or something along those lines - you may want to reconsider if this should be your church home and examine other aspects of it as well!
So, how is Communion supposed to be done then? Acts 2: 42-47 (ESV) explains the contrast very well:
The Fellowship of the Believers
42 And they devoted themselves to the apostles' teaching and the fellowship, to the breaking of bread and the prayers. 43 And awe[d] came upon every soul, and many wonders and signs were being done through the apostles. 44 And all who believed were together and had all things in common. 45 And they were selling their possessions and belongings and distributing the proceeds to all, as any had need. 46 And day by day, attending the temple together and breaking bread in their homes, they received their food with glad and generous hearts, 47 praising God and having favor with all the people. And the Lord added to their number day by day those who were being saved.
You see, the difference in style of Communion is what made it about Jesus, or not about Jesus. Are you breaking bread, praying, helping and inviting all, especially the poor? Or are you throwing a party with middle and upper class friends and family and getting drunk and overeating?
In 1 Corinthians 11:23-26, we read that Paul reminds the Corinthians that the main point of Communion is to remember Jesus’ sacrifice on Calvary and to spread His work of Salvation. And herein is a “hidden” main point of Communion - to inspire others to seek Jesus. You see, when people outside of church and Christianity observe a group of believers eating and praying together to remember Jesus and His sacrifice, the point of the Gospel becomes clear to others and may make them curious to see what this is all about. Now, if they see a raucous party of drunk and wealthy people holding private communion with little to do with outsiders, the message gets portrayed in a negative manner.
This also leads to another aspect of Communion that the Corinthians were doing wrong, and could apply to any one of us today - prayer and confession of sins to the Lord. In 1 Corinthians 11:28 we are told to examine ourselves before we take part in Communion, less we take it in an unworthy manner. Think of it like this - if you don’t stop and pray and examine yourself to make real efforts to overcome sins in your life and participate in Communion, you are basically just eating and drinking, giving no honor to Jesus, the whole reason you gathered in the first place. When we perform this act of self examination, something wonderful happens - we realize our sins and often wonder if we are worthy, and it will be clear if you and your surroundings and fellow participants are doing Communion correct or wrong.
Communion should be a time of celebration AND self examination for the church in which Christians focus on honoring Jesus, showing unity, and proclaiming the gospel of Jesus’ Salvation - not an act to just say you did it, or to be done with a laundry list of sins you have not intention of trying to fix, or a drunken party. The focus should be on others and inviting everyone - not just ourselves or the people we want to be there.
The bottom line is that Communion should honor Jesus and give us a chance to reflect on our hearts (and sins) - not a private party where the point of Jesus gets lost in food and wine and only select people can attend.