What you are looking at is the a terminal block where a telephone was once connected. The wire which disappears into the plaster wall goes to a larger terminal block where it joins the phone line from the street. These basement terminal blocks were originally quite large, like the one discussed in What is this electrical device in my basement? and installed in the basement. Later they become smaller and where frequently installed on the side of the house.
Up into the mid 1970's your typical home tabletop telephone would have a pigtail with spade lugs at the end of its cord. The spade lugs would go under the heads of the screws on this block.
There would be a meta clip crimped onto the cable sheath right at the end. The part of the cable with this clip would be slipped into the slot you see at the top of your terminal block (bottom in my photo) and the little plastic nubs would prevent it from coming out.
A plastic cover with a slot for the cable to exit would be slipped over the whole block and fastened with a screw in the center. (You can see where the screw goes.) This was done by a telephone installer from the phone company.
When a telephone was installed in this way, the customer could not move it. The phone was rented from the phone company and had to be returned when service was canceled. When you called to cancel service, they would tell you to take a pair of scissors and cut the cord and drop the phone off at their office. It was common to see eight inches of cord hanging out of these terminal blocks when you moved into a house which had been previously occupied.
If the customer wanted to be able to move the phone around, the installer would install a four-pin surface-mount jack instead of a terminal block. A four-ping plug would then be installed on the pigtail at the end of the phone cord. There was also a special cover with a four-pin jack on top which could be used to convert a terminal block into a jack. I did not see four-pin jacks very often.
In the mid 1970's the module jack system we know today became standard. For a while the terminal blocks on the wall remained the same, installers simply used a different cover with the jack on the side. Now customers could disconnect their phones without cutting the cord and shortly after that they got the right to connect their own phones bought in department stores. The replacement covers with the jack were widely available in stores.
The dangling cable in your photo runs or used to run to a second phone jack installed later. Rather than running a new wire from the basement, the installer simply extended the existing wire using the old terminal block as a splicing device. (Sometimes they would install jack covers in both locations, though if that had been done here, I would expect to see the broken off spade lugs, but I don't.)
You can remove the dangling cable by loosening the four screws and pulling wires out. Then just re-tighten them to hold the wires from the basement in place. There may still be voltage on them, even if you don't have active phone service. It is generally 48 volts, which is probably below what you can feel, but in one house where I lived it was 90 and was unpleasant to touch. It is DC which is less dangerous, but you should still be careful. If the phone happened to ring while you were touching both the red and the green wires, it would be AC which could be more dangerous, especially to someone with a heart condition.
If you want to remove the terminal block and the cable which goes into the wall, you should trace the cable it to its source and disconnect it first.