Interfacing optoelectric proximity sensor with arduino

If your circuit is as drawn then of course it can't work properly. The LED is clamping the voltage to the input pin to only a few volts(depending on the LED colour) so the input pin will not go to logic high However, it is almost certainly saving your arduino from destruction.
Step back to basics. Forget the arduino for a moment.

If your LED does respond to sensor activity as wired, then the sensor is likely to be a source/sink driven output. These have a built in current limit and that probably why you have not yet destroyed it or the LED.
You must add a resistor in series the LED (470 to 1k ohms or so-its not critical) to limit the current.
Now the sensor and the LED are happy. But you will destroy the arduino if you connect it to the sensor output. (oops 24V on the arduino. Very bad).
Solution: 4.7V zener diode between arduino input and ground.(stripe to the input) Then resistor (2k to 5k is ok for a small zener) from arduino input to sensor output. This will clamp the voltage appearing on the arduino input to a safe value. Sorry I can't be bothered drawing a diagram. Wire this up without the arduino and check voltages first. if ok then connect to arduino and work on the code. Good luck.
Crawl around a bit before standing up - more chance of success.