Why is series LC circuit not behaving as band pass filter?
That's the problem with simulating with "ideal" components &mdash; you see behaviors that you would never see in the real world.

Your circuit has no resistance in it anywhere. The function generator is an ideal voltage source with zero output resistance. The oscilloscope has infinite input resistance (open circuit). And the components have no parasitic series or parallel resistance, either.

Therefore, the behavior that the simulator is showing you is correct. The 503 Hz sine wave is the L-C circuit continuing to "ring" from the start-up transient. This ringing will never die out. And you see none of the 5 kHz square wave at the output because your filter has infinite "Q" (quality factor), which means it blocks other frequencies perfectly.

When simulating a circuit that has only ideal components, you need to remember to model the parasitic effects of real components. Depending on the accuracy that you need, you might include the series resistance of both inductors and capacitors, and maybe some parallel capacitance on inductors and parallel resistance on capacitors as well. Usually, when simulating more complex circuits &mdash; which almost always contain resistors anyway &mdash; the effects of these parasitic components are insignificant.