The article considers the spatial motion of a mechanical system where a heavy beam of a given mass and dimensions is suspended at one end by a weightless inextensible cable to a trolley, which can move along horizontal guides without resistance. The system has five degrees of freedom. Based on the apparatus of analytical mechanics and Lagrange equations, a mathematical model of the considered mechanical system in the form of a system of five nonlinear differential equations of the second order is obtained. The mathematical model is implemented in the form of a computer program that allows you to determine the coordinates (positions) of the beam at any time, build the trajectory of the center of mass, determine the kinematic characteristics of the movement, calculate the cable tension and determine its extreme value. Based on the numerical experiment, graphs and phase trajectories of these parameters are constructed, including the 3D trajectory of the center of mass of the beam. The system can show quite complex dynamics depending on the initial conditions, as evidenced by the results of numerical calculations. Under certain conditions, chaotic behavior of the system is possible. Having a mathematical model and a calculation program, it is possible to conduct further studies of the system under consideration, revealing the positions of stable and unstable equilibrium, modes of self-oscillations, revealing areas of periodic and chaotic modes, bifurcations, and so on.