Bellman-Ford finds shortest paths and detects negative cycles. To find longest paths, negate all edge weights and run Bellman-Ford. The shortest path in the negated graph is the longest path in the original graph. If Bellman-Ford detects a negative cycle, it means there is a positive cycle in the original graph, so the answer is infinite.
Run Bellman-Ford for iterations, then check if any edge can still be relaxed. If yes, there is a negative cycle.