a proton and an electron attract each other. Another way of saying this is that the same or “like” charges repel one another and opposite charges attract one another. Since opposite charges attract each other, the negatively charged electrons are attracted to the positively charged protons.
Also can be understood in a way that electron and proton are of opposite nature in terms of charge and its the law of nature that opposite attracts and simillar repel