To investigate the distribution characteristics and influencing factors of bicycle detour behavior, this study accurately identified detour behavior using global positioning system (GPS) track data from shared bicycles. Factors such as travel time, road conditions, public transportation facilities, and land use types were considered in constructing a detour behavior influence model based on the CatBoost machine learning algorithm. The interpretability of the machine learning framework was enhanced via Shapley additive explanations (SHAP), enabling an analysis of the impact of each factor on detour behavior. The results indicated that the CatBoost model effectively recognized detour behavior with high accuracy. The frequency of detour behavior increased with higher road levels, greater distances to crossing facilities, wider bike lanes, and an increased number of bus stops, subway stations, and leisure and entertainment facilities, while it decreased with a higher number of office commuting facilities. In addition, detour behavior was more prevalent on weekends, during off-peak hours, and under conditions involving physical central lane separation and physical bike lane separation. These findings offer a novel approach for identifying bicycle riding behaviors and analyzing their influencing factors, providing effective technical support for non-motorized traffic management and infrastructure optimization.