There are three musical 'voices' going on here. The bass line, the mid-range melody and the 8th-note accompaniment in the upper stave.
Ideally, this would be played by three instruments. A cello or double bass on the bottom, a tenor-range melody instrument, a keyboard on top. At the point in question, the melody instrument could then hold a full quarter note on that B, while the keyboard could also play its 8th note.
But we're covering all three 'instruments' with one piano keyboard! We must compromise. It is technically impossible to literally hold the melody note full length while also playing the figuration above. But it's quite possible to give the impression that this is happening! This happens a lot in piano music. Don't worry about it.