Here is the classic counterexample: Items: (weight= P0, value= P1), (weight= P2, value= P3), (weight= P4, value= P5). Capacity = 50. Ratios: 6, 5, 4. Greedy takes item 1 (ratio P11), then item 2 (ratio P13). Total weight: 30, total value: 160. Item 3 does not fit (need P17 more, only P18 left).
But items 2 + 3: weight = 50, value = 220. Much better! Greedy got 160, optimal is 220. That's why 0/1 knapsack needs DP. This example shows greedy's local choice blocks a better global solution.